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

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -