Here are 2 ways to strip HTML code from a given text.
Miscellaneous
Remove a Character From a String in JavaScript
How can you remove a character from a string in JavaScript? Here are a few different ways to do this.
Show or hide an element
Quick tip on how to show or hide an element with JavaScript
Return the last element in an array
Use Array.prototype.length – 1 to compute the index of the last element of the given array and return it, otherwise return undefined.
Copy text to the clipboard
Assume that we want to copy a given text to the clipboard. Here’s how.
Confirm Yes or No With JavaScript
How to display a confirm dialog box using JavaScript. The confirm dialog box allows you to perform actions based on the user input.
Get all direct descendant elements that match a test
To do this, we need to combine Node.children with a few other techniques.
Check if all elements in an array are equal
Use Array.prototype.every() to check if all the elements of the array are the same as the first one.
Detect If an Element has focus
To detect if an element has the focus, you use the read-only property activeElement of the document object.
Sanitize an HTML string to reduce the risk of XSS attacks
Sanitizing is the process of removing any attributes, properties, and values that are not included in an allowlist or that are explicitly forbidden on a disallow list.