Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <textarea id="text" rows="5" cols="50">
- <b>At</b> <a href="https://www.w3schools.com">w3schools.com</a> you'll learn how to make a <sup>website</sup>. 5 < 6!
- </textarea>
- <script>
- // https://stackoverflow.com/questions/822452/strip-html-from-text-javascript
- function stripHTMLTags(html){
- var tmp = document.createElement("div");
- tmp.innerHTML = html;
- return tmp.textContent || tmp.innerText || "";
- }
- var textElement = document.getElementById('text');
- var textValue = textElement.value;
- var strippedTextValue = stripHTMLTags(textValue);
- alert(strippedTextValue);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement