How can I find out if a string is a valid HTML tag?
For example: a, or h1, div, or span, ... are a valid HTML tagname. But ar, or abc, or div2, ... are invaild.
You will have to get and use your own array of HTML tags to check this - I would personally go with W3C spec instead of the w3schools one.
Then, you want to use indexOf on the array and check if it's not -1, something like this:
var isValid = function (tagCandidate) {
return (validHtmlTags.indexOf(tagCandidate) > -1);
};