The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery – Better understanding of .live(); Re: jQuery – Better understanding of .live();


To answer your question, you would usually need to tie the event to the parent that is always there and use the on method to listen as the event bubbles up the DOM, like so:

$(“#parentDiv”).on(‘focus’, ‘input[name=emailAddress]’, function () {
// Do stuff

The problem is that the event “focus” does not bubble so what you could do is bind to to focus like you tried to originally – but do this in the “complete” function of your ajax call after the form has been appended to your parent div.

Here’s an example on codepen: