I understand that you can select a page’s HTML with something like $("body").html, but I was wondering if it’s possible to select the visible contents of the HTML?
For example, the following HTML:
<div>
<h1>Hello!</h1>
<p>Main copy text</p>
</div>
Instead of selecting all the HTML, you’d be able to just get:
Hello!Main copy text
Is this possible?
Demo http://jsfiddle.net/MntuX/3/ or http://jsfiddle.net/MntuX/2/ or http://jsfiddle.net/MntuX/
Api:
.text()link http://api.jquery.com/text/code
OR