[jQuery] Re: Adding class to a parent element- traversion help?

2008-10-01 Thread Steve Schnable
How can I unsubscribe it? Steve

[jQuery] Re: Adding class to a parent element- traversion help?

2008-10-01 Thread Vinoj
Grr, well that didn't work. But I understand the basic premise of it, so thank you. -v On Sep 30, 9:55 pm, ricardobeat <[EMAIL PROTECTED]> wrote: > Try an ugly filter function: > > $(".bc-wrapper").filter(function(){ >     return !/^\s+$/.test(this.textContent); // "\s" is a shorthand for > whit

[jQuery] Re: Adding class to a parent element- traversion help?

2008-09-30 Thread ricardobeat
Try an ugly filter function: $(".bc-wrapper").filter(function(){ return !/^\s+$/.test(this.textContent); // "\s" is a shorthand for whitespace/line breaks }).parent().addClass("none"); This will exclude from your selector all elements that have only whitespace in it. Be weary that regexes a

[jQuery] Re: Adding class to a parent element- traversion help?

2008-09-30 Thread Vinoj
@Michael Geary -- Thanks, now I get it. But the code is being output by a CMS, which has some whitespace that is output. So then truncate the whitespace? @FrenchilNLA -- It seemed to make sense, but this didn't work as long as I had that extra space. Once I took out the whitespace that Michael Gea

[jQuery] Re: Adding class to a parent element- traversion help?

2008-09-30 Thread FrenchiINLA
your problem is coming from (this). just try : $(".bc-wrapper:empty").parent().addClass("none"); On Sep 30, 2:09 pm, Vinoj <[EMAIL PROTECTED]> wrote: > I've got the following as my jquery code: > >         $(document).ready(function() { >         $(".bc-wrapper:empty").(this).parent().addClass(

[jQuery] Re: Adding class to a parent element- traversion help?

2008-09-30 Thread Michael Geary
Your div.bc-wrapper isn't empty. It has a text node in it because of the whitespace. Open Firebug on any page that uses jQuery and switch it to the multiline console (orange up arrow at the bottom right). Then paste this code in, hit Ctrl+Enter, and observe the results: $a = $('' ); $b =