[jQuery] Re: test if element as a class

2007-04-27 Thread Michael Price
Alexandre Plennevaux wrote: hello, i'm trying to test a condition whether a link has a given class, and have it return "true" or "false". if ($(this).attr("class")=='refresh') { alert("changing page"); return true; } else { return false; } Try, from memory: if ($(this).is(".CLA

[jQuery] Re: test if element as a class

2007-04-27 Thread pixeline
hi Michael, i just did : if ($(this).filter(".selected")) { return true; } else { and it worked ! On Apr 27, 10:44 am, Michael Price <[EMAIL PROTECTED]> wrote: > Alexandre Plennevaux wrote: > > hello, > > > i'm tryin

[jQuery] Re: test if element as a class

2007-04-27 Thread Dave Cardwell
pixeline wrote: hi Michael, i just did : if ($(this).filter(".selected")) { return true; } else { and it worked ! That's not quite right. .filter() returns a jQuery object, which will always evaluate to true. To u

[jQuery] Re: test if element as a class

2007-04-27 Thread Alexandre Plennevaux
Thank you Dave and Michael! -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dave Cardwell Sent: vendredi 27 avril 2007 11:06 To: jQuery (English) Subject: [jQuery] Re: test if element as a class pixeline wrote: > hi Michael, > > i