HTML code script for a HTML tags remover
Created on 3 July, 2024 • 153 views
HTML code script for a HTML tags remover
<script>
function removeTags(html) {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
return doc.body.textContent || "";
}
// Example usage
const htmlString = "<p>This is a <b>paragraph</b> with some <em>emphasis</em>.</p>";
const textContent = removeTags(htmlString);
console.log(textContent); // Output: This is a paragraph with some emphasis.
</script>
Popular posts
-
HTML script for Bulk URL Opener• 192 views
-
HTML code script for a Signature generator• 160 views
-
HTML code script for a HTML tags remover• 150 views
-
HTML code script for a Safe URL checker• 140 views
-
HTML code scrip for Whirlpool generator• 124 views