Skip to content

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…

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 u…

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…