0

What is wrong with this code?

I'm trying to change the text in a paragraph with the onclick event, it won't just work šŸ¤¦šŸ¤¦ <!DOCTYPE html> <html> <head> </head> <body> <p id="intro">personal details</p> <button type="button" onclick="change()">click</button> <script type="text/javascript"> function change() { getElementById("intro").innerHTML="this paragraph is changed"; } </script> </body> </html>

31st Jan 2020, 6:58 AM
Terry Jephtah Shemishere
Terry Jephtah Shemishere - avatar
3 Answers
31st Jan 2020, 7:04 AM
NightFox
NightFox - avatar
+ 2
Thanks, it worked
31st Jan 2020, 7:05 AM
Terry Jephtah Shemishere
Terry Jephtah Shemishere - avatar
+ 1
It should be- document.getElementById()...
31st Jan 2020, 7:01 AM
Avinesh
Avinesh - avatar