Try to put your javascript in an external file or
in cdata tags <![CDATA[ // javascript goes here ]]> The text inside the CDATA, will be ignored by the w3c parser More info: http://www.w3schools.com/XML/xml_cdata.asp You could also try this method. Not that nice though, but i think it would work: $('.reqdfield').append('<'+'img src="img/icons/reqdfield.gif" alt="This field is required"'+' />'); On Jun 12, 3:06 pm, "Priest, James (NIH/NIEHS) [C]" <[EMAIL PROTECTED]> wrote: > I've got a site in which I'm trying to get W3C validated and running > into a few issue with jQuery and I wondered how people worked around > stuff like this: > > Here I'm injecting some HTML into my site... > > // append a graphic * to the req'd fields > $('.reqdfield').append('<img src="img/icons/reqdfield.gif" alt="This > field is required" />'); > > W3C validator complains about: > ---------- > Line 20, Column 90: document type does not allow element "img" here. > ...d.gif" alt="This field is required" />'); > > The element named above was found in a context where it is not allowed. > This could mean that you have incorrectly nested elements -- such as a > "style" element in the "body" section instead of inside "head" -- or two > elements that overlap (which is not allowed). > ---------- > > I've also got a few places where I have two form fields, one an > autocomplete field, the other a static select field (I need to provide > this for 508). I'm doing a show/hide with jQuery depending on if the > user has JavaScript enabled, and the W3C validator complains about the > fields having the same ID... > > Just curious how people are working around these type of isses using > things like jQuery? > > Thanks, > Jim