Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.28 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Get HTML and styles of element from DOM
  2. <p>
  3.  
  4.   <b>Click</b> to change the <span id="tag">html</span>
  5. </p>
  6. <script>
  7.   $("p").click(function () {
  8.     var htmlStr = $(this).html();
  9.     $(this).text(htmlStr);
  10.   });
  11. </script>
  12.        
  13. <b>Click</b> to change the <span id="tag">html</span>