- Published on
How to fix Javascript ampersand breaking W3C validation
If your page doesn't pass W3C Validation because of Javascript containing:
- Ampersands (&)
- Greater/lesser than (< >)
Encapsulate your script inside a CDATA tag and the W3C parser will ignore it.
<script type="text/javascript">
//<![CDATA[
script here
//]]>
</script>