How To Wrap H1 And Follow Content In Div?
I need to know how to wrap h1 and follow content in div. This is the original structure: This is the result I want to get :
Solution 1:
Try using wrapAll
and group the h1
and all p
tags
$(function () {
$('h1').each(function () {
$(this).nextUntil('h1').add(this).wrapAll('<div />');
});
});
DEMO: http://jsfiddle.net/zPafK/
or http://jsfiddle.net/zPafK/2/ (added some styles)
Post a Comment for "How To Wrap H1 And Follow Content In Div?"