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:

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*