0

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()?

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
Camilla Horne
  • 91
  • 1
  • 7

1 Answers1

2

For dynamically created tags you should bind the events using delegates, try

$(document).on( "focus", "your input selector", function() {

});
Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53
  • Thanks you so much! Both for the correct answer and for the very quick help! I'll mark this as accepted answer when I can (~10 min) :) – Camilla Horne Feb 25 '14 at 11:30