Can anyone help me to figure this out ?
When I use the latest (or a newish) version of jQuery, the small script below works fine. However, when I use older versions
You could use delegate(), for example:
$("table").delegate("td", "click", function() { $(this).toggleClass("chosen"); });
This is equivalent to the following code written using on():
on()
$("table").on("click", "td", function() { $(this).toggleClass("chosen"); });