Need advice on how .on() works
Hi,
The website I'm developing is asp.net so many of my pages postback or partial postback.
Until recently I loaded all my scripts on pageLoad() event rather than document.ready. This enables me to persist my jQuery stuff on postbacks.
Then I discovered the.on() function that allows me to declare my functions in document.ready and my initial thoughts were, if I only need to wire it once, it must be better.
Now I've had a thought which I'm unable to answer due to my lack of experience, so I thought I'd ask.
One of the things that might occur during a postback is that the html structure could change - new elements/removed elements etc.
I'm unsure as to whether jquery will cover these changes given my use of the on() function.
I.e. lets say I have 1 <a class="hover"> element on the original page. Postback causes another <a class="hover"> to be added - will this second element be correctly bound?
Hope I make sense, and look forward to your comments.
Thanks.