I am using jQuery to set the focus/blur events of some input textbox controls via
$(function() {
..
});
But whenever a postback occurs, my controls no longer perform these events. I tried removing them from the document ready event and placing the code at the bottom of document, hoping it would load it each time, but that didn’t work. How can I get these controls to retain there focus/blur events after postbacks?
Didn’t think it mattered, but these postbacks are taking place in an ajax:UpdatePanel
You are attaching the events once to the elements, and they are removed later which means the events are also removed. You could attach the events again and again but you can simply attach the events to a higher level parent node and not worry about it:
I am using the
focusinevent instead offocusbecausefocusdoesn’t bubble.Isolated demo: http://jsfiddle.net/TUqsE/