Javascript error [object HTMLParagraphElement] -
i`m begginer in javascript , need help. so, need that, when push button, paragraph "leftside" appear
<div id="content"> <script> function myfunction() { document.getelementbyid("contentp").innerhtml = leftside; var x = document.getelementbyid("leftside") x.style.display = "normal"; } </script> <button id="buttoni" type="button" onclick="myfunction()">show left side!</button> <p id="leftside" style="display: none">left side</p> <p id="contentp"></p>
you have append leftside contentp
, set display property block
. normal
not valid option
<script> function myfunction() { document.getelementbyid("contentp").appendchild(document.getelementbyid("leftside")); document.getelementbyid("leftside").style.display = "block"; } </script> <button id="buttoni" type="button" onclick="myfunction()">show left side!</button> <p id="leftside" style="display: none">left side</p> <p id="contentp"></p>
Comments
Post a Comment