Possible Duplicate:
jQuery 1.7 – Turning live() into on()
I have with jQuery:
$(".house td[red]").live("click", function() {
alert('ok');
});
but function live is deprecated. How can i use on?
$(".house td[red]").on("click", function() {
alert('ok');
});
not working.
It’s a three-argument variant, and you get to pick the “bubble” point:
The difference is that with this, the point at which the actual event handler is placed is under your control (like with the also-deprecated
.delegate()). You can pick any parent element you like, which is a nice feature in complicated pages. (In your case, for example, you could put the handler on all the “.house” elements instead of the body.)