I am trying to show and hide a div once some data is processed by the php.but the second event is not working.What am i doing wrong?
$(document).ready(function(){ //alert("Document is Ready"); $("form#FormID").submit(function(){ //alert("Form is submitted"); $.post("process.php",{keyword:$("#keyword").val()},function(data) { //alert("Data Loaded: "+ data ); $("div#display-div").html(data).show(); }); return false; }); $("button#hide-btn").click(function(){ $("div#display-div").hide(); }); }); <form action="" method="post" id="FormID"> <input type="text" id="keyword" name="keyword"/> <input type="submit" value="Submit" id="sub" /> </form> <div id="display-div"></div><input id="hide-btn" type="button" value="Hide" />