I have a TextArea which allows the user to enter HTML, what I am now trying to do is to validate the users HTML to ensure it is XHTML.
Any ideas?
I have a TextArea which allows the user to enter HTML, what I am now trying to do is to validate the users HTML to ensure it is XHTML.
Any ideas?
I would suggest using regular expressions. Start at this post here
I havent seen a jquery plugin that does exactly what you want itself, but i'm sure you can alter some existing validation.
You can use a DOM Parser to see 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);
}