JavaScript does not fire after appending [duplicate]

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.

You will likely want to change event handlers so they use the on() method.

Leave a Comment