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');
精彩评论