JQuery after ajax postback (jquery events missing)
Hi, I've got a problem that've seen a lot around, although I have not seen a good solution for it.
I've got an ajax form (a partial view). When the form is posted and the response reparsed by the browser (ie, the DOM recreated, but only for the partial view) all jquery events on that partial view are missing. Obviously the orginal DOM was destroyed and a new one is build, but shouldn't the new DOM objects be automatically bound to their corresponding events?
Some solutions I've seen:
1. to use "on" or "live" to attach events (this does not works if you want to attach a datepicker)
2. to put your event wiring code on pageLoag function instead of on $(document).ready() (but what about event wiring code from any plugin or sutff I'd migth be using, like unobtrusive validation or some)
Shouldn't this be done by jquery itself, I mean, reparse and rewire all elements even if they are elements of a partial view?
Is there a solution for this I could use?
Thanks a lot in advance,
Amanda