Ah yes, good catch Jake. I'd forgotten about that.
Karl Rudd On 5/9/07, Jake McGraw <[EMAIL PROTECTED]> wrote:
Yes, two methods: 1) Use the src attribute for the script tag and keep JavaScript out of your XHTML documents. or 2) Use a commented out <![CDATA[ ]]> tag to indicate sections of code the validator should skip over, like: <script type="text/javascript"> // <![CDATA[ $(function(){$("body").append('<div>Hello, world</div>');}); //]]> </script> - jake On 5/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote: > > Hi, > > I have this block of JQuery > > $(document).ready( > function () { > doTDListBehavior(); > > $('#addNewTDItem').click( function() { > $('#todoList').append("<div > class="sidebarToDo"><table cellpadding="0" > cellspacing="0" border=" > 0"><tr><td><input type="checkbox" > name="completed"></td><td width="100%" > align="left" class="sidebarText">" + > genEditableItemHTML("") + "</td><td > align="right"><a class="editTDItem" > href="#" title="Edit"><img src="images/ > edit.gif" alt="Edit" border="0"></ > a></td><td align="right"><a > class="deleteTDItem" href="#" > title="Delete"><img src="images/ > deleteLink.gif" alt="Delete" border=" > 0"></a></td></tr></table></ > div>"); > setEditableHandlers($ > ('div.sidebarToDo:last').find(" input.editableTDItem")); > return false; > }); > } > ); > > You'll notice the massive string witih "<"s and """s. I had to > put these in, because when I didn't, the W3C validator was > complaining, interpreting what was in the "append" as real tags. > However, now, instead of HTML getting inserted into my DOM, the text > above literally gets displayed on screen. That is, "<div > class="sidebarToDo" ..." appears on screen. Is there a way that the > string can be interpreted as HTML AND pass validation? > > Thanks, - Dave > >