Event Listener for Dynamically Created Elements
You can just register it in advance with .on(): Live demo (click). $(document).on(‘click’, ‘some-selector’, function() { }); or create the dom element newTerm before appending it and attach the function directly: Live demo (click). var $newTerm = $(newTerm); $newTerm.click(function() { }); Since the selector you’re adding to the element is a dynamic id, I’d recommend … Read more