0

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

4
  • 1
    Check here for JS validation github.com/jshint/jshint Commented Jul 30, 2013 at 4:21
  • okay ty got it , btw any clues for HTML syntax checking too....? Commented Jul 30, 2013 at 4:23
  • HTML here validator.w3.org Commented Jul 30, 2013 at 4:24
  • no but if i use w3.org wont it require internet connection always, as what i am trying to do here (sorry did not mention it earlier) is make an local app and so i want offline options for validating the syntax, and i saw some such validators in some text editors i use but could not figure out how they work Commented Jul 30, 2013 at 4:37

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

you also used to javascript error using firbug extension is used to show error javascript.

you get firebug using that link
http://getfirebug.com/

Comments

0

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.

1 Comment

no actually what i wanted to do was ask the user to write some script on the fly and then the backend will process it for any errors so chrome developer tools wont help there i feel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.