Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. $("p").each(function(){
  2.  
  3. // Add a div after the second <br /> (in the current <p>)
  4. $("br:eq(1)", this).after('<div class="theRest"> </ div>');
  5.  
  6. // Split each "child" in an array
  7. $(this).contents().filter(function(index, elem){
  8.  
  9. // Keep only children after the <div />
  10. return index > 3;
  11.  
  12. // Remove and put them into the <div />
  13. }).detach().appendTo($(".theRest", this));
  14. });
  15.  
  16. $('p').each(function() {
  17. $(this).contents(':gt(2)').wrap('<div class="theRest"></div>');
  18. });
  19.  
  20. $('.father').find('p').each(function() {
  21. $(this).contents(':gt(2)').wrap('<div class="theRest"></div>');
  22. });
  23.  
  24. $($("p").contents().get(2)).after('<div class="theRest"></div>');
  25. $("p").contents().filter(function(index, element) {
  26. return index > 3;
  27. }).detach().appendTo(".theRest");
  28.  
  29. var txt = $('.txt').contents();
  30. txt.splice(0,1);
  31. txt.wrapAll($("<div>").addClass('red'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement