[jQuery] appending text nodes

[jQuery] appending text nodes

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 <karl@englishrules.com>
> 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:dalvarado@remanresource.com]
> dalvarado@remanresource.com> <[LINK: mailto:dalvarado@remanresource.com]
> dalvarado@remanresource.com> wrote:
>
>
> -------Original Message-------
>
> From: Kristinn Sigmundsson <[LINK: mailto:zelexir@gmail.com]
> zelexir@gmail.com>
>
> 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:dalvarado@remanresource.com]
> dalvarado@remanresource.com <[LINK: mailto:dalvarado@remanresource.com]
> dalvarado@remanresource.com>