Skip to content
Advertisement

Tag: dom

Javascript Won’t replace image

My Js code below is a quiz game. Each question takes up a full page, which means we have to change all the content every time the user presses the next button. My issue is, i can’t seem to get the image to switch to the next by fully replacing it. In my case the new images just go to

innerText is different in a cloned node

(NOTE: This question isn’t the same as the similar one above, as it is about differences between attached and detached DOM trees.) A simple bit of HTML containing a DIV with no whitespace between its elements: I output innerText to the console three times. The first time is that of the original DIV: The second is that of the cloned

How to loop over document.body in a function

I have to write a version of getElementsByClassName but i’m having trouble using document.body in my function. It only returns null when called. I realize that the recursion part needs to be fixed and finished but first I’d like to know how to access document.body (along with its childNodes) and use it in a function. Or maybe I’m approaching it

How to target selected radio buttons?

Below is my code and I am getting movies data from an API and I am creating different elements using Javascript create Element like title, rating and favorite radio button for selecting favorite movies now I wonder how to target all the selected radio buttons because I have generated radio buttons dynamically and its getting very hard to target those

How to get an element inside a function javascript

I’m trying to use the value that each book has on its “status” and make the function “changeStatus()” run but “book.status” is defined inside a function, how can I get it? or is there any other way i can change the button behavior on click? I tried using a querySelector but it only allows me to click one button per

How do I iterate the array, then show all the elements in HTML? [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 months ago. Improve this question I’m learning javascript, I try my best to use correct “word” to describe

Advertisement