Live() instead in jquery 1.26?



$('#content').find('p:eq(0)').append('<span class="more"> | more</span><span class="less"> | less</span>')
$('p:gt(0)').hide();

$('.more, .less').live('click', function() {
    $('#content').find('p:gt(0)').slideToggle();
    $('.more, .less').toggle();
})

i using drupal-6,the jquery is 1.26. if i don’t want to upgrade the jquery. is there a way to get the effect?

jquery is 1.26 haven’t have a suppport to the live() function. is there another function can instead of it. or alter the code to get the effect?

I’ve had a look at the documentation and I don’t think so. You could try looking in the actual jQuery code and exporting the code they’ve used. But it would probably be easier to use the livequery plugin, if you can add other js files to your code.

Another option is to just write your own. The method just takes advantage of event bubbling (as explained with a nice diagram here), which is not a new thing. I’d take a close look at the pitfall mentioned in that article.