RandomByte :: Forum :: Wiki

JavaScript and XHTML validation

Not to long ago I ran into a scenario where I had a web page that was failing to validate cleanly as XHTML because of a < (less then sign) character in a block of JavaScript.

The solution was to insert a set of //<![CDATA[ and //]]> lines at the beginning and end of the script. This told the validation routine to pass over and ignore everything between the two lines. Also any > and & charaters in the javascript can causes problems, aswell.

[code][/code]

Reference: