live() instead in jquery 1.26?
[CODE]
$('#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();
})
[/CODE]
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?
some one told me to [B]dd a normal click handler to .content, then check whether $(e.target).is('.more, .less').[/B]
i alter the code to this [CODE]
$('#content').find('p:eq(0)').append('<span class="more"> | more</span><span class="less"> | less</span>')
$('p:gt(0)').hide();
$('#content').click(function(){
if($(e.target).is('.more, .less'))
{
$('#content').find('p:gt(0)').slideToggle(); $('.more, .less').toggle();
}
})
[/CODE]
but it can't work.