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("&lt;div
> class=&quot;sidebarToDo&quot;&gt;&lt;table
cellpadding=&quot;0&quot;
> cellspacing=&quot;0&quot; border=&quot;
> 0&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;input
type=&quot;checkbox&quot;
> name=&quot;completed&quot;&gt;&lt;/td&gt;&lt;td
width=&quot;100%&quot;
> align=&quot;left&quot; class=&quot;sidebarText&quot;&gt;"
+
> genEditableItemHTML("") + "&lt;/td&gt;&lt;td
> align=&quot;right&quot;&gt;&lt;a
class=&quot;editTDItem&quot;
> href=&quot;#&quot; title=&quot;Edit&quot;&gt;&lt;img
src=&quot;images/
> edit.gif&quot; alt=&quot;Edit&quot; border=&quot;0&quot;&gt;&lt;/
> a&gt;&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;a
> class=&quot;deleteTDItem&quot; href=&quot;#&quot;
> title=&quot;Delete&quot;&gt;&lt;img src=&quot;images/
> deleteLink.gif&quot; alt=&quot;Delete&quot; border=&quot;
>
0&quot;&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/
> div&gt;");
>                         setEditableHandlers($
> ('div.sidebarToDo:last').find(" input.editableTDItem"));
>                         return false;
>                 });
>         }
> );
>
> You'll notice the massive string witih "&lt"s and "&quot"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
>
>


Reply via email to