Guest User

Untitled

a guest
Jul 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <code> ... </code>
  2.  
  3. <pre> ... </pre>
  4.  
  5. $('code').replaceWith( "<pre>" + $('code').html() + "</pre>" );
  6.  
  7. <code> A </code>
  8. <code> B </code>
  9. <code> C </code>
  10.  
  11. <pre> A </pre>
  12. <pre> A </pre>
  13. <pre> A </pre>
  14.  
  15. $('code').contents().unwrap().wrap('<pre/>');
  16.  
  17. $('code').replaceWith(function(){
  18. return $("<pre />", {html: $(this).html()});
  19. });
  20.  
  21. $('code').replaceWith(function(){
  22. return $("<pre />").append($(this).contents());
  23. });
  24.  
  25. $('code').each(function() {
  26. $(this).replaceWith( "<pre>" + $(this).html() + "</pre>" );
  27. // this function is executed for all 'code' elements, and
  28. // 'this' refers to one element from the set of all 'code'
  29. // elements each time it is called.
  30. });
  31.  
  32. $('code').each(function(){
  33.  
  34. $(this).replaceWith( "<pre>" + $(this).html() + "</pre>" );
  35.  
  36. });
  37.  
  38. $('code').each(function () {
  39. $(this).replaceWith( "<pre>" + $(this).html() + "</pre>" );
  40. });
Add Comment
Please, Sign In to add comment