Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--original markup-->
- <strong>I AM STRONG</strong>
- <strong>I AM STRONG</strong>
- <strong>I AM STRONG</strong>
- <strong>I AM STRONG</strong>
- <strong>I AM STRONG</strong>
- <!-- new markup -->
- <div>
- <strong>I AM STRONG</strong>
- <strong>I AM STRONG</strong>
- </div>
- <div>
- <strong>I AM STRONG</strong>
- <strong>I AM STRONG</strong>
- </div><div>
- <strong>I AM STRONG</strong>
- </div>
- var elems = $("strong");
- for (var i=0; i<elems.length; i+=2)
- {
- elems.slice(i,i+2) // split off a pair
- .wrapAll("<div>"); // wrap it
- }
- $('strong:odd').each(function(){
- var divElement = $('<div></div>').append($(this).prev(), $(this));
- // Now add the divElement to a new container?
- });
Add Comment
Please, Sign In to add comment