jquery - Why doesn't my javascript function swap pi id html contents as written? -
the p id="demo"
contents don't switch when click button on testing & hosted environ. not sure why? think code correct?
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript"> function mywhen() { document.getelementbyid("demo").innerhtml = "when-estimated time complete fall 2016."; } </script> </head> <body> <ul> <li><button onclick="mywhen()"><p>when?</p></button></li> </ul> <div class="textbox"> <p id="demo">a paragraph written<br>another line here</p> </div> </body> </html>
your code right & it's working. check results here..
function mywhen() { document.getelementbyid("demo").innerhtml = "when-estimated time complete fall 2016."; }
<ul> <li><button onclick="mywhen()"><p>when?</p></button></li> </ul> <div class="textbox"> <p id="demo">a paragraph written<br>another line here</p> </div>
Comments
Post a Comment