I am wondering why below code is not working. Could anybody of you help me, please?
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#button").click(function () {
$("#hide").toggle();
});
});
</script>
<asp:Button ID="button" runat="server" Text="button" OnClientClick="return false" />
<div id="hide">
<asp:Button ID="show" runat="server" Text="example" />
</div>
</asp:Content>
EDIT:
What in case when the button is in gridview or nested gridviev?
When I use
$("#<%= button.ClientID %>")
it returns me an error: "The name 'button' does not exist in the current context."
Will you be able to help me in that case?