I have a TextArea that allows the user to enter HTML, what I'm trying to do now is check the users HTML to make sure that it is XHTML.
Any ideas?
You can use the DOM Parser to find out if the content is XML.
See here .
SNIPPET:
if (window.DOMParser) { parser=new DOMParser(); xmlDoc=parser.parseFromString(text,"text/xml"); } else // Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.loadXML(text); }
I would suggest using regular expressions. Start with this post here.
I have not seen a jquery plugin that does exactly what you want, but I'm sure you can modify some existing validations.