seena
seena

Reputation: 21

javascript validation error

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?

Upvotes: 2

Views: 146

Answers (2)

meder omuraliev
meder omuraliev

Reputation: 186762

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>

Upvotes: 3

Bruno Reis
Bruno Reis

Reputation: 37832

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

Upvotes: 2

Related Questions