changing DIV visibility with JavaScript

html, javascript, visibility

Solution

Change your CSS to:

#show_button{
 display: none
}

And you in your javascript:

function show(){
  //alert("cheked the button - worked");
  document.getElementById('show_button').style.display= 'block' ;
}

Problem

EDIT: Since the question has became quite popular I will fix the problem so it will be working code example. The original problem is still listed, But the code works. i am trying to show a div after pressing a button but this wont work, any idea why is that? ``` <form action="insert.php" method="POST" align="right" id="post_form"> <input type="button" value="click me" onClick="show()"> <div id="show_button"> fdsfds </div><br> </form> #show_button{ visibility:hidden; } function show(){ // alert("cheked the button - worked"); document.getElementById("show_button").style.visibility= 'visible' ; } ```

Original source