I use the following PHP code to generate some JS and echo it in my page
$var_x = $var_x . "var_array[$var_count] = '<div class=\"var_div\"></div>'; ";
However, when I try to validate it with the W3C validator, I get the following error.
'document type does not allow element "div" here'
The error highlights the > at the end of the tag
What could be the problem?
Use the XHTML CDATA section to denote areas where you may be working with HTML. This will let the validator know that it needs to ignore the contents and not try to parse it.