Re: [jQuery] Removing Parent Node

2006-12-26 Thread David Duymelinck
Mohsen Saboorian schreef: > David, > Naturally it doesn't work :) > > if($(this).is("span.a")) would never be true, since "this" is refering > to the parent node of "span.a". > > It was too easy to be true :) I thought because it was in an each loop this referred to the elements caught by the p

Re: [jQuery] Removing Parent Node

2006-12-26 Thread Ⓙⓐⓚⓔ
try this... it keeps other embedded tags. $("span.a").each(function() { $(this).after($(this).html()).remove() }) On 12/25/06, Mohsen Saboorian <[EMAIL PROTECTED]> wrote: > Thanks Jake, but un

Re: [jQuery] Removing Parent Node

2006-12-26 Thread Mohsen Saboorian
David, Naturally it doesn't work :) if($(this).is("span.a")) would never be true, since "this" is refering to the parent node of "span.a". > $("span.a").parent().each(function() { > if($(this).is("span.a")){ > var t = $(this).text(); > $(this).html(t); > } > }); ___

Re: [jQuery] Removing Parent Node

2006-12-25 Thread David Duymelinck
Mohsen Saboorian schreef: > Thanks Jake, but unfortunately it does't fix my problem.The parent node might > have other children which should not be changed, e.g. > abc efgh ijkl > should be changed to: > abc> efgh ijkl > Thanks. > On 12/26/06, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote:> try:>> > $("span

Re: [jQuery] Removing Parent Node

2006-12-25 Thread Mohsen Saboorian
Thanks Jake, but unfortunately it does't fix my problem. The parent node might have other children which should not be changed, e.g. abc efgh ijkl should be changed to: abc> efgh ijkl Thanks. On 12/26/06, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote: > try: > > $("span.a").parent().each(function() {

Re: [jQuery] Removing Parent Node

2006-12-25 Thread Ⓙⓐⓚⓔ
try: $("span.a").parent().each(function() { var t = $(this).text() $(this).html(t) }) On 12/25/06, Mohsen Saboorian <[EMAIL PROTECTED]> wrote: > Hi, > I have a node list this: > > > abcd > efgh > ijkl >

[jQuery] Removing Parent Node

2006-12-25 Thread Mohsen Saboorian
Hi, I have a node list this: abcd efgh ijkl mnop qrst Now, how can I remove all internal spans to have a single (now parent) span holding all letters, having a jQuery object which contains all span.aelements. I tried this but not working: $("span.a").each(function() { th = $(this);