$(document).on('click', '.edit-select a', function() {
// do stuff
});
jQuery is only aware of the elements in the page at the time that it runs, so new elements added to the DOM are unrecognized by jQuery. To combat that use event delegation, bubbling events from newly added items up to a point in the DOM that was there when jQuery ran on page load. Many people use document
as the place to catch the bubbled event, but it isn't necessary to go that high up the DOM tree. Ideally you should delegate to the nearest parent that exists at the time of page load.
Keep in mind that elements added to the DOM dynamically during page load can be bound to without relying on bubbling and delegation as long as events are bound to them after the element has been included. Consider the following example -
var newKid = '<div class="kid">Jan</div>';
$('.parent').append(newKid);
$('.kid').click(function() {
var kidName = $(this).html();
var message = kidName + ' got clicked<br />';
$('.whoGotClicked').append(message);
});
var newKid = '<div class="kid">Cindy</div>';
$('.parent').append(newKid);
Who do you think will be added to the 'got clicked' list here? Marsha is included in the original markup and Jan was added to the DOM as the script ran, but prior to the click event being bound to the kid class. Cindy was added to the DOM after the binding occurred. Both Marsha and Jan are handled by the click event while Cindy is left in the cold. Using event delegation
$(document).on('click', '.kid', function() {...
will insure that all kids, now and in the future, will get handled.