How to update the parent page in jquery

javascript - bootstrap - How can you attach events to dynamic HTML elements in jQuery?

I'm adding a new answer to reflect changes in later versions of jQuery. The .live () method has been deprecated since jQuery 1.7.

From http://api.jquery.com/live/

As of jQuery 1.7, the .live () method is obsolete. Use .on () to attach event handlers. Users of older versions of jQuery should use .delegate () instead of .live ().

For jQuery 1.7+, you can append an event handler to a parent by using .on () and passing the a selector in combination with 'myclass' as an argument.

See http://api.jquery.com/on/

So instead of ...

You can write...

This works for all tags with 'myclass' in the body, whether they already exist or dynamically added later.

The body tag is used here because the example had no closer static surrounding tag, but any parent tag that is present when the .on method is called will work. For example, a UL tag for a list to which dynamic elements are added would look like this:

As long as the ul tag exists, this will work (no li elements still need to exist).