Using direct input into the W3schools validator I am getting many errors, but a lot of those errors are very similar stating things like:
character data is not allowed here:
var $tr = $("<tr class='optionAndAnswer' align='center'>");
(pointing at ” at the end)
Also I keep getting this below which I don’t quite understand what the problem is:
How about this?
var $options = $("<td><table class='option'><tbody><tr><td class='opt'>1. Option Type:</td></tr></tbody></table></td>");
It sounds like you are using XHTML and placing your JavaScript inline in a
<script>element.The simplest way to solve this is to not use XHTML, which brings more trouble then benefits for most people. Use HTML 4.01 Strict or the HTML 5 draft instead.
If you want to persist in using XHTML then…
In XHTML the rules for script elements change and no longer contain intrinsic CDATA (because XML doesn’t support it). This means that
<means “Start of tag” as usual and not “A less than sign”. You must either use explicit CDATA markers or represent characters with special meaning (such as<) by character references (such as>).Since most XHTML is served as
text/htmlyou need to write your XHTML so that it is compatible with HTML parsers as well as XHTML parsers. The character reference approach will break in HTML parsing mode.See the HTML Compatibility Guidelines which explain how to munge CDATA markers to be compatible with HTML and XHTML in script elements. Do note their recommendation to use external scripts.