I have an asp.net application with an asp: button, which causes a postback, which means that the html for input has an onclick attribute that is automatically generated, I need to add an event via jQuery to the onclick attribute, which before automatic generated reverse gear.
Below is an example of the html created, I need to make sure that my event added by jQuery fires before the WebForm_DoPostBackWithOptions () function.
<input id="ctl00_MainContent_Save" type="submit" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$MainContent$Save", "", true, "", "", false, false))" value="" name="ctl00$MainContent$Save">
for clarity, I know that I can add an event through jQuery as follows:
$('#ctl00_MainContent_Save').click(function() { somfunction(); });
but I want my event to fire before WebForm_DoPostBackWithOptions
source share