I’m using a small snippet of JS to add a presentational element to my blockquotes (As seen here):
<script type="text/javascript">
$('blockquote.message').append('<span class="arrow" />');
</script>
But the W3C validator hates that crap:
document type does not allow element “span” here
What am I doing wrong? Is there a way to correct this error, while maintaining the function?
Thanks!
I assume you’re using XHTML? You need wrap your JavaScript in CDATA:
See the XHTML reference here: http://xhtml.com/en/xhtml/reference/script/ – “If the script element contains embedded script and that script contains XHTML markup characters such as <, >, & and “, then the script should be enclosed in CDATA”