$("button#hide-btn") selects nothing, it's an input element not a
button. There is a ':button' pseudo-selector in jQuery, but if you are
selecting by ID the tag name is unncessary and may even be slower.

$('#hide-btn'), $('#FormID'), $('#display-div')

- ricardo

On Oct 29, 10:19 am, Tallu <[EMAIL PROTECTED]> wrote:
> 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" />

Reply via email to