There is such code:

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

Ajax loaded content that includes the above elements. How to "прибиндить" to them this hover?

  • one
    Try to return the same script in Ajax. - Maksym Prus
  • Or, alternatively, $(function(){$("AJAX_RETURNER").find("ul#mmenu li")}); - Maksym Prus
  • Does not work. Yes, and it seems to me that this is not an option. Somehow through bind or live, I just can't figure it out. - DemoS
  • one
    Try not to return HTML, but JSON with a pointer to the function that will build this HTML. Then there will be no questions. - Stanislav Komar

1 answer 1

 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 is best to hang it through live:

 $("ul#mmenu li").live('mouseenter', AA).live('mouseleave', BB); 
  • Googled, made in the 2nd way, then read your answer)) But thanks anyway! - DemoS