I encountered a problem in Firefox that it doesn't support InnerText when I try to extract only text from an HTML.
document.getElementById("mainDiv").InnerTextIt works fine in chrome. So tried to remove the HTML tags from the InnerHTML string. Below is the solution for that.
var html = document.getElementById("mainDiv"); var text = html.replace(/<\S[^><]*>/g, '');
No comments:
Post a Comment