Reputation: 2124
I was trying a simple Try It editor and i wanted to know that how do i validate the code that the user has entered be it HTML or a script , how do i know if it has any errors? also, are there any library's for doing that
Upvotes: 0
Views: 1440
Reputation: 205
I just check stackoverflow, and found this one,maybe it helps you.
var xml = 'Caleb';
var parser = new DOMParser();
var doc = parser.parseFromString(xml, 'text/xml');
Check for XML errors using JavaScript
Upvotes: 1
Reputation: 955
if you are using chrome, then use google developer tools (press ctrl+shift+i), there you will find various options in the tab like ELEMENT(to see html code, styles of your document),CONSOLE(you will find errors and warning there), this is very useful, try and explore this one only.
Upvotes: 0
Reputation: 5824
you also used to javascript error using firbug extension is used to show error javascript.
you get firebug using that link
http://getfirebug.com/
Upvotes: 0