Added input-field using before() does not trigger on focus()
-
21-12-2019 - |
Question
I have some code where I use the before()
method to insert an input-field
amongst other things. But for some reason the input-fields
created dynamically does not trigger on $("input").focus()
.
How do I get the new input-fields to trigger on focus()
?
Solution
For dynamically created tags you should bind the events using delegates, try
$(document).on( "focus", "your input selector", function() {
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow