bind to loaded elements



  • There's a code like this:

    $("ul#mmenu li").hover(
        function(){$("span.move, span.onoff",this).css("opacity",1)},
        function(){$("span.move, span.onoff",this).css("opacity",0)}
    );
    

    Ayax is loaded with content including the above elements. How "прибиндить" This hover?



  • function AA(){$("span.move, span.onoff",this).css("opacity",1)}
    function BB(){$("span.move, span.onoff",this).css("opacity",0)}
    $("ul#mmenu li").hover(AA, BB);
    
    $.load(_blablabla_);
    _blablabla_.hover(AA, BB);
    

    Although it's best to hang through the live:

    $("ul#mmenu li").live('mouseenter', AA).live('mouseleave', BB);
    


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2