archana roy
archana roy

Reputation: 1167

Toggle function in jquery

I have a button on click of which i want to either show/hide a content which is places in a div. How can we implement this? Also whats the error in the code below--

   <head runat="server">
   <title>Toggle Functionality</title>

<script src="jquery-1.3.1.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function(){
 $("button").click(function () {
 $("p").toggle("slow");
});
});
</script>

</head>
 <body>
<form id="frmQuery" runat="server">
    <table>
        <tr>
            <td>
         <asp:Button ID="imgForm" runat="server" ImageUrl="~/Image/Khushi1.jpg" />
            </td>
        </tr>

    </table>
     <p>
            Toggle displaying 
        </p>
</form>

        </body>

Upvotes: 0

Views: 140

Answers (1)

Jan Willem B
Jan Willem B

Reputation: 3806

The asp:Button control renders to an <input type="submit"> html element. So you should use

$("input[type=submit]") 

instead of

$("button")

Upvotes: 1

Related Questions