Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.
1 vote
3 answers
83 views

is there a difference between elements created dynamically with JavaScript and elements in HTML

take the code below: contentsDiv.innerHTML = container.outerHTML; if(contentsDiv.firstChild === container) console.log('true'); in this code, contentsDiv is a div created in my html file ...
Miachi Solomon's user avatar
-3 votes
1 answer
65 views

addEventListener vs onclick - which one overwrites the other? [duplicate]

If I use both Which one runs? Do they both run? Having trouble understanding the difference. const button = document.getElementById('button') button.onclick = function() { console.log('onclick'); } // ...
Jyosna Vuttla's user avatar
1 vote
1 answer
41 views

getCSRFToken is not defined error, JavaScript

This is the part of the code in the Django + JavaScript Todo App that is responsible for deleting a note. I need a csrftoken for this, but the JS is showing me an error in the console. What did I do ...
Aram Madoyan's user avatar
0 votes
0 answers
52 views

Is there a way to make the image be the height of neighboring text? [duplicate]

I have an image on the left, which is always square, and some text on the right (it can be one <p> or multiple, it depends). The text should be rendered normally and the image on the left should ...
Stefan Garlonta's user avatar
0 votes
2 answers
69 views

xpath filtering misleading misconception behavior [closed]

I have noticed this xpath misleading behavior problem, for this expression: elemA[ not(elemB) ] it has two meanings: 1. yes show all elemA filtered all childs elemB. eg: select all elements but ...
mr.tee's user avatar
  • 43
0 votes
1 answer
53 views

ReactJS - Javascript addEventListener does not remove the listener function at component's unMount

I have added an event listener to "keydown" event in my ReactJS application. Because of a third party library, I'm adding it via setTimeout in a useEffect, this component is like a popup, so ...
GLHF's user avatar
  • 4,068
2 votes
2 answers
63 views

Can a HTMLCollection change while iterating through it, even though no changes to DOM are made in THIS thread?

So, I have a mystery bug that is hard to reproduce, and so far my best suspect is this code: function getMagicElement(root) { var collection = root.getElementsByTagName('span'); for ( var i = ...
Vilx-'s user avatar
  • 107k
1 vote
1 answer
50 views

Web Components: Slots are not working as (I) expected in light DOM

How can I change the following light DOM custom element to show the content of the default slot between (!!!) the two horizontal rulers? Please be aware, that I cannot use shadow DOM in my use case. &...
Natasha's user avatar
  • 886
2 votes
1 answer
61 views

jsPDF adds image at incorrect size and position when using dimensions from getBoundingClientRect and clientHeight/clientWidth

I am trying to add an HTMLElement to a PDF after converting it to an image using "toPng" from "html-to-image". The HTMLElement exists inside another, that plays the role of the ...
El baz Houcine's user avatar
0 votes
0 answers
104 views

Updating HTML element causes PointerLockControls to stutter in three.js

For quite some time, I've had an issue in three.js where when putting any HTML element updates in my animation loop, my PointerLockControls always have a strange stutter. For example: function animate(...
Parking Master's user avatar
0 votes
0 answers
98 views

How to change iFrame src with a default value when the original src does not exist?

I have the following basic html code in a file called default.html: <html> <head></head> <body> <input id="year" type="number" min="2000" ...
Safwan's user avatar
  • 356
0 votes
1 answer
27 views

Traversing and Transforming Children of preact components

I've recently had a problem with needing to traverse and transform some DOM children from a Parent Preact component: import {isElevated} from "../stores/UserStateStore.ts"; import type {...
Paul Krahn's user avatar
0 votes
2 answers
50 views

New line in a X post

I wrote a browser extention for social media handling. You can e.g. reformulate your given text to make it more positive etc. Now if I insert the response to the X - Reply Textarea back it does not ...
MaTok's user avatar
  • 401
1 vote
1 answer
57 views

Why is my `<p id="time">` not displaying anything when using JavaScript in a separate file?

I'm trying to display the current time inside a paragraph element using JavaScript. My HTML and JavaScript are in separate files. Here's my HTML snippet: <p id="time"></p> And ...
ariori Abdulrofii''s user avatar
0 votes
0 answers
44 views

getElementById() returns null in JavaScript [duplicate]

I'd like to create a dynamic select menu in JavaScript and hit a problem below. When I run the codes below, I got an error which reads "Uncaught TypeError: Cannot read properties of null (reading ...
hopstepforward's user avatar

15 30 50 per page
1
2 3 4 5
2786