[jQuery] Re: Toggle state

2007-07-25 Thread Adrian Lynch
Hey all, I haven't had time to test but reading elsewhere it seems is(':visible') is the way to go. Thanks for the replies. Adrian On Jul 25, 7:24 am, Stephan Beal <[EMAIL PROTECTED]> wrote: > On Jul 24, 5:25 pm, "Glen Lipka" <[EMAIL PROTECTED]> wrote: > > > $("p").toggle(function(){ > > $(th

[jQuery] Re: Toggle state

2007-07-24 Thread Stephan Beal
On Jul 24, 5:25 pm, "Glen Lipka" <[EMAIL PROTECTED]> wrote: > $("p").toggle(function(){ > $(this).addClass("selected"); > someVar = true;},function(){ > > $(this).removeClass("selected"); > someVar = false; > > }); Instead of setting someVar, can't $(element).is("selected") be used?

[jQuery] Re: Toggle state

2007-07-24 Thread Glen Lipka
I thought of something similar, but I wasn't sure if the toggle is hiding anything. The question didnt specify. Glen On 7/24/07, Ganeshji Marwaha <[EMAIL PROTECTED]> wrote: a simple solution that i could think of is $("mySelector").is(":visible"); This should return true if your element is v

[jQuery] Re: Toggle state

2007-07-24 Thread Ganeshji Marwaha
a simple solution that i could think of is $("mySelector").is(":visible"); This should return true if your element is visible and false otherwise. Untested though -GTG On 7/24/07, Glen Lipka <[EMAIL PROTECTED]> wrote: First thing that comes to mind is to set a variable inside the two sides

[jQuery] Re: Toggle state

2007-07-24 Thread Glen Lipka
First thing that comes to mind is to set a variable inside the two sides of the toggle. $("p").toggle(function(){ $(this).addClass("selected"); someVar = true; },function(){ $(this).removeClass("selected"); someVar = false; }); Glen On 7/24/07, Adrian Lynch <[EMAIL PROTECTED]> wrote: H