There are two easy and short ways of doing this possible.
1: If we use inline Javascript, we can wrap the code inside the CDATA tag in, conjunction with some Javascript comments to show to the validator that our content from inside the script should not be validated as XHTML:
[code]
<script type="text/javascript">
/*<![CDATA[*/
//Javascript code here
/*]]>*/
</script>
We can also use another version, both of these wrappers will work:
[code]
<script type="text/javascript">
//<![CDATA[
//Javascript code here
//]]>
</script>
2: Another way of doing this is to remove the script from the page and store it in a .js file which will be called by our page like in the example from bellow:
[code]
<script type="text/javascript" src="thescript.js">
//A comment here
</script>
In this example "thescript.js" is the script itself stored into an external .js file (minus the surroundig "SCRIPT" tags. Comments within the script tags are still allowed.
discuss this topic to forum
