开发者

wrap elements already created (after, before, etc.)?

I've already created my divs in Jquery, but i would like to wrap them all in a div, to work with slideToggle. But i don't see how i can do that, could you please help me?

here's my code :

var $container = $('...(bug)div class="container">')    
                .hide()    
                .appendTo($monid)    
                .fadeIn('slow')    
                .before('..(bug)div class="up">')    
                .after('..(bug)div class="down">');    

and i would like to wrap the divs : "up, down, container" to a new div. 开发者_如何学GoDo you have any solution?

Thanks


You can use wrapall.

http://api.jquery.com/wrapAll/

Something like this:

$(".up, .down, .container").wrapAll("<div/>")


var $container = $('div.container')
.hide()
.appendTo($monid)
.fadeIn('slow')
.before('div.up')
.after('div.down');

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜