Detecting data changes in forms using jQuery

后端 未结 10 2024
遇见更好的自我
遇见更好的自我 2020-12-05 13:27

I\'m using ASP.NET 2.0 with a Master Page, and I was wondering if anyone knew of a way to detect when the fields within a certain

or fieldset<
10条回答
  •  一向
    一向 (楼主)
    2020-12-05 14:06

    The following solution worked for me:

    $("#myDiv :input").change(function() { $("#myDiv").data("changed",true);});
    }
      
    if($("#myDiv").data("changed")) {
    console.log('Form data changed hence proceed to submit');  
    }
    else {
    console.log('No change detected!');
    }

    Thanks

提交回复
热议问题