SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    436
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    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();
    })
    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?

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •