'dynamic created content bind keyup change javascript

Well I've been reading on how to do this, but no success so far.

At first I thought the problem was another, then I read about dynamic created content and that you have to bind it to something already in web.

I've tried using this, but im sure I'm not using it correctly:

$(document).on('keyup', 'email', function () {
  //the code from below here.
});

how do I bind this?



Solution 1:[1]

Try adding all the elements to the query selector or just use the same class for both.

$(".email1, .email").on("keyup change", 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 Rodrigo Balibrera