Guest User

Untitled

a guest
Jun 22nd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <!--original markup-->
  2. <strong>I AM STRONG</strong>
  3. <strong>I AM STRONG</strong>
  4. <strong>I AM STRONG</strong>
  5. <strong>I AM STRONG</strong>
  6. <strong>I AM STRONG</strong>
  7.  
  8. <!-- new markup -->
  9. <div>
  10. <strong>I AM STRONG</strong>
  11. <strong>I AM STRONG</strong>
  12. </div>
  13. <div>
  14. <strong>I AM STRONG</strong>
  15. <strong>I AM STRONG</strong>
  16. </div><div>
  17. <strong>I AM STRONG</strong>
  18. </div>
  19.  
  20. var elems = $("strong");
  21. for (var i=0; i<elems.length; i+=2)
  22. {
  23. elems.slice(i,i+2) // split off a pair
  24. .wrapAll("<div>"); // wrap it
  25. }
  26.  
  27. $('strong:odd').each(function(){
  28. var divElement = $('<div></div>').append($(this).prev(), $(this));
  29. // Now add the divElement to a new container?
  30. });
Add Comment
Please, Sign In to add comment