How To Get JavaScript Code XHTML 1.0 Strict Validated


Under certain circumstances we are left with no other choice but to write our JavaScript code in the XHTML file itself. And after that when we try to validate our site with the XHTML validator we get errors for the JS code. Lets see how we can get these validated properly.

Problem generally arises with the “<” or “>” symbols used in loops or conditions or any HTML used within the JavaScript (for example setting any HTML with innerHTML).

To validate these JavaScript codes wrap them with CDATA.


Now the JavaScript codes in the HTML document will pass the XHTML Strict validation.

This entry was posted in HTML, Javascript and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *