I am using a onclick function on my form submit button to hide a div. but it is not hiding. what is the best way to do this? I want to hide a div on my page, after submitting a form.
<form action="" method="POST"> <input type="submit" onclick="hide_group_posts();"> </form> <div id='div_i_want_to_hide'> <?php include $_SERVER['DOCUMENT_ROOT']."page.php";?> </div> <script> function hide_group_posts(){ $('#div_i_want_to_hide').hide(); } </script>
hide_group_postswas declared after the button? Anyway don't use inline code if you're using jQuery.