I´ve got a small script, that should wrap a div "wrap_mod_article" around every single parent div "mod_article".
if ($("body").hasClass("test")) {
$('#content .mod_article').wrapAll('<div class="wrap_mod_article" />');
}
Right now the script creates one div thats around all divs with the class "mod_article". How is it right to wrap a div "wrap_mod_article" around every div with "mod_article"?
If you want a clear div at the bottom inside the wrap_mod_article
use:
$('#content .mod_article .wrap_mod_article').append('<div class="clear" />');
The selector takes all .wrap_mod_article
inside the .mod_article
articles from the content
container and appends the div with a class clear
.
Update jsfiddle:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.