Reputation: 87
I want to know that how can i get innerHtml without the html tags. Only the text.
Upvotes: 1
Views: 4527
Reputation: 8402
If you're not using jQuery (or even if you are), this link explores some of the different options (eg innerText vs textContent), along with how they differ between browsers:
http://www.davidtong.me/innerhtml-innertext-textcontent-html-and-text/
Basically, not all approaches work in all browsers, and some strip line breaks while others don't.
Upvotes: 5
Reputation: 10619
You could use the text() function instead:
Use $("your_element").text()
You can use also:
document.getElementById("your_element").textContent;
Upvotes: 2
Reputation: 2064
if you're using jquery, use $('myelem').text()
.
API Reference: http://api.jquery.com/text/
Upvotes: 5