If I want to dynamically add a form to my webpage (through AJAX or other JavaScript methods), how can I attach event listeners to these elements before they actually exist on the page?
When using jQuery, it's simple to bind the events to a parent element like this:
$(document).on('blur', 'input', function() {...})
However, I'm not sure how to achieve this with plain JavaScript, as addEventListener
requires direct application to the element itself and doesn't allow specifying a parent element for event propagation. Am I correct in thinking this way?