I am adding a click event (display alert on click) to a html hyperlink inside an UpdatePanel on document(ready). However, the event never gets fired when I click the hyperlink. Is it because of ASync postback? What is the correct way to do this? $(document).ready(function() $(‘#addExcl’).click(function() alert(‘asassasaas’);return false; ); });…………
via Asp.Net Developed Tutorials » Search Results » ajax:
Attach event to hyperlink click inside update panel?
I am adding a click event (display alert on click) to a html hyperlink inside an UpdatePanel on document(ready). However, the event never gets fired when I click the hyperlink. Is it because of ASync postback? What is the correct way to do this?
$(document).ready(function()
$(‘#addExcl’).click(function()
alert(‘asassasaas’);return false;
);
});
……………………………………..
You need to attach the even in every ajax update because the dom struct is change and the events are lost on the part of the update.
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
function InitializeRequest(sender, args)
function EndRequest(sender, args)
$(‘#addExcl’).click(function()
alert(‘asassasaas’);
return false;
);
}
For more info: Attach event to hyperlink click inside update panel?
Asp.Net Developed Tutorials » Search Results » ajax