- Get HTML and styles of element from DOM
- <p>
- <b>Click</b> to change the <span id="tag">html</span>
- </p>
- <script>
- $("p").click(function () {
- var htmlStr = $(this).html();
- $(this).text(htmlStr);
- });
- </script>
- <b>Click</b> to change the <span id="tag">html</span>