Thanks.  I incorporated your suggestion ... this is where item was coming from

var item = $(this).parents("div.sidebarToDo").find("td.sidebarText").text();

Things work great. - Dave


>  -------Original Message-------
>  From: Karl Swedberg <[EMAIL PROTECTED]>
>  Subject: Re: [jQuery] appending text nodes
>  Sent: Feb 22 '07 16:17
>  
>  Hi Dave,
>  
>  
>  Not sure where the "item" variable is coming from, but you can try setting
>  the variable first with .text() and then just including that variable name
>  in the append string.
>  
>  
>  Something like this:
>  
>  
>  var item = $('your-selector-goes-here').text();
>  
>  
>  And then, instead of $.text(item) in the append string, just use item.
>  So:
>  
>  
>  
> $(this).parents("div.sidebarToDo").find("td.sidebarText").empty().append("<input
>  type=\"text\" size=\"10\" class=\"editableTDItem\" value=\"" + item +
>  "\">");
>  
>  
>  --Karl
>  
>  _________________
>  
>  Karl Swedberg
>  
>  www.englishrules.com
>  
>  www.learningjquery.com
>  
>  
>  On Feb 22, 2007, at 11:06 AM, <[LINK: mailto:[EMAIL PROTECTED]
>  [EMAIL PROTECTED]> <[LINK: mailto:[EMAIL PROTECTED]
>  [EMAIL PROTECTED]> wrote:
>  
>  
>   -------Original Message-------
>  
>   From: Kristinn Sigmundsson <[LINK: mailto:[EMAIL PROTECTED]
>  [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, [LINK: mailto:[EMAIL PROTECTED]
>  [EMAIL PROTECTED] <[LINK: mailto:[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
>  
>  [LINK: mailto:[EMAIL PROTECTED] [email protected]
>  
>  [LINK: http://jquery.com/discuss/] 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
>  
>  [LINK: mailto:[EMAIL PROTECTED] [email protected]
>  
>  [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to