+ 3
Help my code not work
<button onclick="btn()"> read more </button> <p id="a"> </p> <style> function btn() { document.getElementById("a").innerHTML = "hi"; } </style> Error: btn() not defined This is made by in my mind, not by someone
3 Answers
+ 5
Just replace 'style' tag with 'script' tag.
"style" tag is for CSS
"script" tag is for JS
+ 4
Replace "style" with "script". You have created your Javascript function inside embedded style block.
+ 4
WOW,
I always do this simplest mistake, sorry guys!, And thanks!