'JQuery events wont work on dynamic content [duplicate]

I want to add a new line each time the enter key is pressed. But delegation is not setup properly... Can someone make the simple change to this code? Thanks.`



Solution 1:[1]

dynamic content will not bind event you can try this:

$('tbody').on('keypress', '.myInput', function(){
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 databorker