There is no need for quotes as everything is already a string. Jeremy, you need to understand what's going on:
$('[class^=Round_gen]').filter(function(){ // checks for any element where the 'class' attribute starts with 'Round_gen' return /Round_gen[0-9]+/.test( $(this).attr('class') ); // 'test' is a method of the regular expression, that will test this element's attribute 'class' against it, returning true or false. there is no attribute called 'Round_gen' }).each(function(){ var n = $(this).attr('class').match(/[0-9]+/); // again, we are testing the CLASS attribute against the regex, this will return the matched part (i.e the numbers in the classname) //in here you also want your code for each element, $(n) is not gonna do anything as n is just a number, use $(this) }); hope it's clearer now! - ricardo On Sep 23, 6:13 pm, tlphipps <[EMAIL PROTECTED]> wrote: > Just need some quotes around the class name (I forgot to include some > quotes in my example too) > > This should work: > $("[class^='Round_gen']") > > On Sep 23, 4:04 pm, jeremyBass <[EMAIL PROTECTED]> wrote: > > > So tring to get this going I did > > > var n = ''; > > $('[class^=Round_gen]').filter(function(){ > > return /Round_gen[1-9][0-9]+/.test( $(this).attr('Round_gen') > > );}).each(function(){ > > > var n = $(this).attr('Round_gen').match(/[0-9]+/); > > > }); > > > $('.Round_gen'+n+'').each(function() {...ect > > > and Got it picking up .Round_gen only ... not Round_gen9 or > > Round_gen99 > > > I think I'm close > > thanks for the help... > > jeremyBass > > > On Sep 23, 11:49 am, jeremyBass <[EMAIL PROTECTED]> wrote: > > > > So let say the class was named Round_gen9 > > > > I'd replace > > > > $('.Round_gen9'').each(function() {....etc > > > > with > > > > $('[class^=Round_gen]').filter(function(){ > > > return /Round_gen[0-9]+/.Round_gen( $(this).attr('Round_gen') > > > );}).each(function(){ > > > > var n = $(this).attr('Round_gen').match(/[0-9]+/); > > > // the number after 'class' for current element}); > > > > $('n').each(function() {....etc > > > > nothing is showing up... so I don't think this is fully right (I mean > > > what I wrote) > > > ideas?? > > > > Thanks for the help here... > > > jeremyBass > > > > On Sep 23, 11:26 am, ricardobeat <[EMAIL PROTECTED]> wrote: > > > > > Using [class^=class] is your best bet, the other option is to loop > > > > over all the possibilities and that is a no-go. Coupled with the > > > > filter function this will give you all elements with classX where X is > > > > a number: > > > > > $('[class^=class]').filter(function(){ > > > > return /class[0-9]+/.test( $(this).attr('class') > > > > );}).each(function(){ > > > > > var n = $(this).attr('class').match(/[0-9]+/); // the number > > > > after 'class' for current element > > > > > }); > > > > > hope this helps. > > > > > - ricardo