I was reading http://api.jquery.com/delegate/ and I learned that any .delegate()
code can be written with an equivalent .on()
code. The link provides this example:
For example, the following .delegate() code:
$( "table" ).delegate( "td", "click", function() {
$( this ).toggleClass( "chosen" );
});
is equivalent to the following code written using .on():
$( "table" ).on( "click", "td", function() {
$( this ).toggleClass( "chosen" );
});
I am using a legacy system with jQuery 1.3.1. It uses .livequery()
extensively. I want to get rid of this Live Query plugin, but still continue to use jQuery 1.3.1 for a while. Please do not give me an answer recommending that I simply upgrade to the latest version of jQuery or use .on()
instead, since .on()
is not available in jQuery 1.3.1. For now, I must continue using jQuery 1.3.1, but replace all appearances of .livequery()
with an equivalent using .delegate()
. Is that possible? I am wondering if there are things that you do with .livequery()
, that cannot be done with a .delegate()
equivalent. Thank you.
I kept Live Query because my main objective was upgrading jQuery, not getting rid of Live Query.