0

I am new to JavaScript and want to know whether I should include the CDATA tag in the JavaScript place when I am validating HTML document (which has the JavaScript). And can I know if there is a way to validate JavaScript?

Thank you so much!

arthrax
  • 161
  • 2
  • 4
  • 12
  • thank you. And is there a way I can validate JavaScript? – arthrax Sep 08 '15 at 17:33
  • Can you give an example of what you're trying to validate? HTML and JavaScript are usually not validated themselves... *input* given in HTML elements may need to be validated, but it's difficult to know if that's what you're trying to do without an example. – devlin carnate Sep 08 '15 at 17:37

1 Answers1

0

See: What is CDATA in HTML?

So if you intend to parse the HTML document as an XML document, you'll need to add the CDATA.


You can validate JavaScript with lint tools like JSLint or JSHint, most IDEs will have some form of integration for these tools.

Community
  • 1
  • 1
Halcyon
  • 57,230
  • 10
  • 89
  • 128