[jQuery] Re: Simple Selector Question -- Context

2008-12-04 Thread Joe

Thanks Ricardo, looks good.

On Dec 3, 10:14 am, ricardobeat <[EMAIL PROTECTED]> wrote:
> Or pError.filter(':visible').
>
> By using 'pError' as a context, you are looking for it's children, not
> the elements themselves.
>
> - ricardo
>
> On Dec 3, 1:17 pm, Liam Potter <[EMAIL PROTECTED]> wrote:
>
> > it would be this
>
> > $('p.error:visible')
>
> > Joe wrote:
> > > If I have the following:
>
> > > var pError = $('p.error');
>
> > > Then I can do the following with no problem:
>
> > > pError.text('lorem");
>
> > > Yet, I want to check for the paragraphs that have the class "error"
> > > that are visible, I would think it is something like this:
>
> > > var visibleError = $(':visible', pError);
>
> > > However, this fails.
>
> > > Is this because the visible selector is different in creating the
> > > wrapped set of paragraph tags with the class error?
>
> > > What is the proper way of using the context of pError with the visible
> > > selector?
>
> > > Thanks!


[jQuery] Re: Simple Selector Question -- Context

2008-12-04 Thread Joe

Liam,

Right, but that defeats the point of "caching" the jQuery object that
was created by:

var pError = $('p.error');

Since I'm just calling it again with a different selector, namely,
the :visible one.

On Dec 3, 9:17 am, Liam Potter <[EMAIL PROTECTED]> wrote:
> it would be this
>
> $('p.error:visible')
>
> Joe wrote:
> > If I have the following:
>
> > var pError = $('p.error');
>
> > Then I can do the following with no problem:
>
> > pError.text('lorem");
>
> > Yet, I want to check for the paragraphs that have the class "error"
> > that are visible, I would think it is something like this:
>
> > var visibleError = $(':visible', pError);
>
> > However, this fails.
>
> > Is this because the visible selector is different in creating the
> > wrapped set of paragraph tags with the class error?
>
> > What is the proper way of using the context of pError with the visible
> > selector?
>
> > Thanks!


[jQuery] Re: Simple Selector Question -- Context

2008-12-03 Thread ricardobeat

Or pError.filter(':visible').

By using 'pError' as a context, you are looking for it's children, not
the elements themselves.

- ricardo

On Dec 3, 1:17 pm, Liam Potter <[EMAIL PROTECTED]> wrote:
> it would be this
>
> $('p.error:visible')
>
> Joe wrote:
> > If I have the following:
>
> > var pError = $('p.error');
>
> > Then I can do the following with no problem:
>
> > pError.text('lorem");
>
> > Yet, I want to check for the paragraphs that have the class "error"
> > that are visible, I would think it is something like this:
>
> > var visibleError = $(':visible', pError);
>
> > However, this fails.
>
> > Is this because the visible selector is different in creating the
> > wrapped set of paragraph tags with the class error?
>
> > What is the proper way of using the context of pError with the visible
> > selector?
>
> > Thanks!


[jQuery] Re: Simple Selector Question -- Context

2008-12-03 Thread Liam Potter


it would be this

$('p.error:visible')

Joe wrote:

If I have the following:

var pError = $('p.error');

Then I can do the following with no problem:

pError.text('lorem");

Yet, I want to check for the paragraphs that have the class "error"
that are visible, I would think it is something like this:

var visibleError = $(':visible', pError);

However, this fails.

Is this because the visible selector is different in creating the
wrapped set of paragraph tags with the class error?

What is the proper way of using the context of pError with the visible
selector?

Thanks!
  




[jQuery] Re: Simple selector question

2007-04-10 Thread Geoffrey Knutzen
Ah, got it.

I tripped myself up again, because on my test page, all of the tables were
collapsed. 

 

Thanks for following up on this. You probably saved me a bunch of
troubleshooting about a month or two from now

 

  _  

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Karl Swedberg
Sent: Monday, April 09, 2007 3:55 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Simple selector question

 

On Apr 9, 2007, at 4:31 PM, Geoffrey Knutzen wrote:





Again, 

Press send, find answer.

I answered my own question

$("table").css("borderCollapse","collapse")

 

I had led myself down the wrong path and was totally lost

 

Thanks anyway

 

 

Hi Geoff,





that's fine if you want to *set* the borderCollapse property to "collapse"
for all tables. But if you are trying to select them, using .each() with an
if statement inside or Brandon's .filter() suggestion would be want you
need.

 

Cheers,

 

--Karl

_

Karl Swedberg

www.englishrules.com

www.learningjquery.com

 





 

 



[jQuery] Re: Simple selector question

2007-04-09 Thread Karl Swedberg

On Apr 9, 2007, at 4:31 PM, Geoffrey Knutzen wrote:


Again,
Press send, find answer.
I answered my own question
$("table").css("borderCollapse","collapse")

I had led myself down the wrong path and was totally lost

Thanks anyway



Hi Geoff,

that's fine if you want to *set* the borderCollapse property to  
"collapse" for all tables. But if you are trying to select them,  
using .each() with an if statement inside or Brandon's .filter()  
suggestion would be want you need.


Cheers,

--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com






[jQuery] RE: Simple selector question

2007-04-09 Thread Geoffrey Knutzen

 
Again, 
Press send, find answer.
I answered my own question
$("table").css("borderCollapse","collapse")

I had led myself down the wrong path and was totally lost

Thanks anyway



-Original Message-
From: Geoffrey Knutzen [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 09, 2007 1:27 PM
To: 'jquery-en@googlegroups.com'
Subject: Simple selector question

 
How would one select all tables in a document that have the css property
border-collapse set to collapse?

My goal is to make a work around for a FF bug
(https://bugzilla.mozilla.org/show_bug.cgi?id=244135) where borders
disappear sometimes. I am hoping for find all tables with
border-collapse=collapse, set them to separate then set them back to
collapse again. 

Thanks
-Geoff



[jQuery] Re: Simple selector question

2007-04-09 Thread Brandon Aaron


You could also use filter to get a jQuery object of the tables that
have borderCollapse == collapse.

var $tables = $('table').filter(function() {
 return $(this).css('borderCollapse') == 'collapse';
});

Now you can run any jQuery methods you might need on this result set.
That is if you need to use this group of tables again later.

--
Brandon Aaron

On 4/9/07, Karl Swedberg <[EMAIL PROTECTED]> wrote:

Hi Geoff,

You should be able to loop through he tables with .each() and see if they
have the css property border-collpase set to "collapse" and if so, do
something. The following should work -- inside a $(document).ready(), of
course:

$('table').each(function() {
  if ($(this).css('borderCollapse') == 'collapse') {
//do your magic
  };
});



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com





On Apr 9, 2007, at 4:26 PM, Geoffrey Knutzen wrote:



How would one select all tables in a document that have the css property
border-collapse set to collapse?

My goal is to make a work around for a FF bug
(https://bugzilla.mozilla.org/show_bug.cgi?id=244135) where
borders
disappear sometimes. I am hoping for find all tables with
border-collapse=collapse, set them to separate then set them back to
collapse again.

Thanks
-Geoff





[jQuery] Re: Simple selector question

2007-04-09 Thread Karl Swedberg

Hi Geoff,

You should be able to loop through he tables with .each() and see if  
they have the css property border-collpase set to "collapse" and if  
so, do something. The following should work -- inside a $ 
(document).ready(), of course:


$('table').each(function() {
  if ($(this).css('borderCollapse') == 'collapse') {
//do your magic
  };
});



--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Apr 9, 2007, at 4:26 PM, Geoffrey Knutzen wrote:




How would one select all tables in a document that have the css  
property

border-collapse set to collapse?

My goal is to make a work around for a FF bug
(https://bugzilla.mozilla.org/show_bug.cgi?id=244135) where borders
disappear sometimes. I am hoping for find all tables with
border-collapse=collapse, set them to separate then set them back to
collapse again.

Thanks
-Geoff





[jQuery] Re: Simple selector question

2007-04-09 Thread Andy Matthews

$('table').attr('css','border-collapse')

Maybe?

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Geoffrey Knutzen
Sent: Monday, April 09, 2007 3:27 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Simple selector question


 
How would one select all tables in a document that have the css property
border-collapse set to collapse?

My goal is to make a work around for a FF bug
(https://bugzilla.mozilla.org/show_bug.cgi?id=244135) where borders
disappear sometimes. I am hoping for find all tables with
border-collapse=collapse, set them to separate then set them back to
collapse again. 

Thanks
-Geoff