Reputation: 1429
I am trying to validate my page using the W3C validator but it keeps looking within the script tag of the javascript and failing. any ideas?
Upvotes: 2
Views: 299
Reputation: 186562
It gets treated as PCDATA since it's XHTML ( XML ). Mark it as CDATA per When is a CDATA section necessary within a script tag? and you should be ok:
<script type="text/javascript">
//<![CDATA[
...code...
//]]>
</script>
Alternatively you can stop attempting to use XHTML by using HTML 5, or throw the code in an external JS file if it's feasible.
Upvotes: 5