开发者

jQuery append html

开发者 https://www.devze.com 2023-02-08 20:23 出处:网络
jQuery(\'.block\').append(html); How do I run livequery on this append? I\'ve ht开发者_如何学JAVAtp://fancybox.net on my image, trying to execute it for appended html. You can do this, to aim your
jQuery('.block').append(html);

How do I run livequery on this append?

I've ht开发者_如何学JAVAtp://fancybox.net on my image, trying to execute it for appended html.


You can do this, to aim your images :

$('.block').find('#myImages img').fancybox();

If that doesn't work, you can look the accepted answer here : Fancybox, getting Fancybox to bind using LIVE() to items being loaded onto the page after load


Let's say you did this on page load:

$('#myImages').fancybox();

And doing the following appended more #myImages:

$('.block').append(html);

Then you can bind .fancybox() to just those elements:

$('.block').find('#myImages').fancybox();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号