How to capture submit event using jQuery in an ASP.NET application?

前端 未结 8 2072
既然无缘
既然无缘 2020-12-01 03:11

I\'m trying to handle the submit event of a form element using jQuery.

    $(\"form\").bind(\"submit\", function() {
        alert         


        
8条回答
  •  猫巷女王i
    2020-12-01 03:27

    If you are using .NET Framework 3.5 or up, you can use ScriptManager.RegisterOnSubmitStatement() in your server-side code. The registered script will get called both on normal submit and on DoPostback.

    ScriptManager.RegisterOnSubmitStatement(this, this.GetType(), "myKey", "SomeClientSideFunction();");
    

提交回复
热议问题