Mike Thanks a Lot!
Works like a charm! and thanks for the nice // comments Regards Mario 2008/9/5 Michael Geary <[EMAIL PROTECTED]> > Your question isn't really about "this", but about how to get some text > that isn't in its own element. It's just a text node inside the .tr > element. > > Can you put it in a span? > > <div class="tr"> > <span class="x">my text please!</span> > <div class="w">I dont want this children</div> > </div> > > Then you could just use: > > var tr = $('.x',this).html(); > > You can get the text from the HTML code you have, though. Here's one way > that comes to mind - but maybe there is something simpler. Are you sitting > down? :-) > > var tr = $.trim( $(this).clone().children('.w').remove().end().html() ); > > Let's break that down (in fact, you may like to format it this way in your > code instead of the one-liner): > > var tr = $.trim( // remove extraneous whitespace when done > $(this) // jQuery object for the element > .clone() // clone it so we don't change the original > .children('.w') // select the div.w child element > .remove() // remove it > .end() // go back to the cloned element > .html() // and get its HTML > ); > > (We'll see how much of that formatting survives posting...) > > -Mike > > ------------------------------ > *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Mario Moura > *Sent:* Friday, September 05, 2008 11:51 AM > *To:* jquery-en@googlegroups.com > *Subject:* [jQuery] "this" - Basic question > > Hi Folks > > I have: > > $(".tr").each(function(i){ > $(this).bind("click", function(event){ > var tr = $(this).html(); > ..... > > > My html is > > <div class="tr">my text please! > <div class="w">I dont want this children</div> > </div> > > I am trying select only "my text please!" without children(). > > I tried .remove() .not(".w") .not("div.w") and a lot of variations > > Look I am not working in the "document" I have this in "this" argument. > > so > > $(this).html() = my text please! <div class="w">I dont want this > children</div> > > so I want remove <div class="w">I dont want this children</div> > > Regards > > Mario > macm > > -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-3264-6203 31-9157-6000