0

change HTML content with JS function

Hello, I am having troubles setting HTML with JS function. The code below is supposed to alter the content of the Paragraph. I am using separate html and js files. <div onchange="funct_1();"> <p id="here_1">Value</p> </div> function funct_1(){ document.getElementById("here_1").innerHTML="done"; return; }

16th Mar 2022, 1:09 PM
Philipp
Philipp - avatar
3 Answers
+ 1
@FF9900: I tried but didn't succeed until I used window.onchange within JS. Thank you for your suggestions, highly appreciated!
17th Mar 2022, 11:16 AM
Philipp
Philipp - avatar
+ 1
I think, you're trying to automate things.... Try this..... $('.classname or #id of div').bind('DOMSubtreeModified', function() { document.getElementById('here_1').innerHTML = "done"; });
17th Mar 2022, 4:29 PM
Shailendra Maurya
0
had this thought at first as well. Maybe I need a different event. even tried onmouseover is <p> not changeable?
16th Mar 2022, 1:20 PM
Philipp
Philipp - avatar