10
Dec/08
0

HTML Javascript Validation!

Okay so the title for this post is a little bit strange. I don’t really know how to describe it other than to say this.

You know when you’re trying to validate a webpage, but it won’t because some of the javascript has html in it which is picked up by the validator as invalid?

Well, if you do know what I’m talking about, here’s a fix (it’s been annoying me for ages):

If you’re not using external javascript files, to prevent the validator from spitting errors from your javascript code,

simply surround them within CDATA tags, like this:

<script type="text/javascript">
/* <![CDATA[ */
var myfunction = function(){

};
/* ]]> */
</script>
Filed under: Tech
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment


No trackbacks yet.