[jQuery] Re: get the class that starts with ...

2008-11-12 Thread Bradley Sepos
Per Richard's comment, if you know the tag names of the elements that will match the class (like div, p), you can do the following: $("div,p").filter(function(){ var classes = $(this).attr("className").split(" "); var found = false; for (var i = 0; i < classes.length; i++)

[jQuery] Re: get the class that starts with ...

2008-11-11 Thread Richard D. Worth
Don't forget that elements can have more than one class (each separated by a space), so such a test will only pass if it's the first in the list. - Richard On Tue, Nov 11, 2008 at 6:22 PM, Rik Lomas <[EMAIL PROTECTED]> wrote: > > To get a class that begins with 'rate', you can do > $('*[classNam

[jQuery] Re: get the class that starts with ...

2008-11-11 Thread Rik Lomas
To get a class that begins with 'rate', you can do $('*[className^="rate"]') Note that the attribute is className, not class $('*[className^="rate"]').each(function () { alert( $(this).attr('className').split('rate')[1] ); }); 2008/11/11 debussy007 <[EMAIL PROTECTED]>: > > > Hi, > > How is i

[jQuery] Re: get the class that starts with ...

2008-11-11 Thread Jeffrey Kretz
Try $('[class^=rate]'); -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of debussy007 Sent: Tuesday, November 11, 2008 3:15 PM To: jquery-en@googlegroups.com Subject: [jQuery] get the class that starts with ... Hi, How is it possible to get the