why it doesn't work would probably because of this from the jquery src:
text: function(e) {
if ( typeof e == "string" )
return this.empty().append( document.createTextNode( e
) );
.
.
as you havn't provided more code the best thing I could suggest is to do this:
$(this).parents("div.sidebarToDo").find("td.sidebarText").empty().append("<input
type=\"text\" size=\"10\" class=\"editableTDItem\" value=\"" +
document.createTextNode(item) + "\">");
//Kristinn
On 2/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > -------Original Message-------
> > From: Kristinn Sigmundsson <[EMAIL PROTECTED]>
> > Subject: Re: [jQuery] appending text nodes
> > Sent: Feb 22 '07 15:42
> >
> > Hm, you empty it and then append to it? wouldn't that be the same as
> > using .html(val)? If that is what you'd want to do, try the .text()
> > command:
> > $(this).parents("div.sidebarToDo").find("td.sidebarText").text(val)
> >
> > contents of "td.sidebarText" will be replaced with val
> >
> > On 2/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > Hi, I want to append text to a node. I'm using this code
> > >
> > >
> > $(this).parents("div.sidebarToDo").find("td.sidebarText").empty().append(val);
> > >
> > > but if the variable "val" contains special characters, like "<td>", that
> > will mess up the rest of my tree. What is the best way to handle this?
> > >
> > > Thanks, - Dave
> > >
> > > _______________________________________________
> > > jQuery mailing list
> > > [email protected]
> > > http://jquery.com/discuss/
> > >
> >
>
> Thanks. This is what I wanted to do. One further question about the "text"
> command. I'm getting a JS error when I try to implement the following:
>
>
> $(this).parents("div.sidebarToDo").find("td.sidebarText").empty().append("<input
> type=\"text\" size=\"10\" class=\"editableTDItem\" value=\"" + $.text(item)
> + "\">");
>
> Your thoughts? Thanks, - Dave
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/