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.
Get a list of valid HTML tags (or whatever you want to compare with) and simply do something like:
function IsValid(s) { var tags = ['a', 'p', 'etc...']; return tags.indexOf(s) != -1; }