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 > $('*[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 it possible to get the class that starts with 'rate' of an element > ? > > > > the class could be rate1, rate5, rateXYZ. > > I don't know what follows the substring 'rate'. > > I need to get the number that follows rate. > > > > Thank you for any help ! > > -- > > View this message in context: > http://www.nabble.com/get-the-class-that-starts-with-...-tp20450061s27240p20450061.html > > Sent from the jQuery General Discussion mailing list archive at > Nabble.com. > > > > > > > > -- > Rik Lomas > http://rikrikrik.com >