-4

Possible Duplicate:
jQuery .on does not work but .live does

I just can't find a clear answer.

I used to use the $('.someclass).live('click', function ... ) for items created on the fly with JS, which of course does not work when updating jQuery 1.9.0 (thanks guys). I have been looking around and could not find a good answer. So, here's the question again :

What is the equivalent to .live for items created on the fly without having to reassign a click listener everytime i create a new item ? It is still working perfectly with older jQuery versions !!

Delegate, on and live are a no go. What is going on ?

Community
  • 1
  • 1
Eric
  • 9,870
  • 14
  • 66
  • 102

1 Answers1

5

Try this:

$(".someparent").on("click", ".someclass", function() {
    // ...
});

Where .someparent is the selector to the .someclass parent element.

joaobarbosa
  • 630
  • 5
  • 13