Why is this small javascript not working? -


I have several instances of a div with a "myDiv" id on a page, I want to change the contents of these divs When I use this javascript:

  Replace Functionantant (id, content) {var container = document.getElementById (id); Container.innerHTML = Content; } Replacement content ('myDiv', 'Hello there'); & Lt; Div id = "mydiv" & gt; & Lt; / Div & gt; & Lt; Div id = "mydiv" & gt; & Lt; / Div & gt; & Lt; Div id = "mydiv" & gt; & Lt; / Div & gt;  

It only changes the content within one of those devices and not all of them. If I use jquery's .html () function, then it changes the content of all divs. Is there a way that I can work with JS on the same scale?

The ID value should be unique - you may not have more than one ID with the same name and in them You can update everyone from


Comments