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 "&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