Greetings all,
I have a simple JQuery function which is bound to an ASP:Button and fires when the submit button is clicked, like this:
<asp:Button ID="btnSubmit" CssClass="btnSubmit" OnClick="btnSubmit_Click" runat="server"
Text="Send" />
$(document).ready(function () {
$(".btnSubmit").click(function () {
alert("button clicked");
});
});
This code runs correctly the first time the page is loaded, but never runs again after clicking Submit (and a post/postback occurs). The asp button code is within an UpdatePanel. It seems like the JQuery code is being "unregistered" or unbound after the postback. I have a ScriptManager control on the page but this is all I'm doing with it:
<asp:ScriptManager ID="ContactFormScriptManager" runat="server">
<Scripts>
<asp:ScriptReference Path="Scripts/jquery-1.4.1.js" ScriptMode="Auto" />
<asp:ScriptReference Path="Scripts/contact-form.js" ScriptMode="Auto" />
</Scripts>
</asp:ScriptManager>
I suspect there's more I need to do with ScriptManager to make sure my JQuery code stays registered, but I'm not sure what. Your suggestions would be appreciated.
Thanks, -NorthK