views:

29

answers:

2

here's my code, which says error when i run it through w3.validator.org.

for (var i = 0; i < CheckBox.length; i++)

error message - character "<" is the first character of a delimiter but occurred as data

how do i fix this?

+2  A: 

Is your input XHTML? If so, to validate it as XML you would need a CDATA block to contain your javascript code.

Bruno Reis
+3  A: 

If you are "using" XHTML then you need to wrap the code in CDATA:

<script type="text/javascript">
//<![CDATA[

// rest of your javascript goes here

//]]>
</script>
meder