SAbboushi
asked on
jquery to change class of element
Hi-
Can someone help me: I need the jquery statement to change the class of the button below from ff_elem to bfNextButton and the jquery code to instead add bfNextButton to the class (instead of replace the class value)
Thanks-
Sam
Can someone help me: I need the jquery statement to change the class of the button below from ff_elem to bfNextButton and the jquery code to instead add bfNextButton to the class (instead of replace the class value)
<button class="ff_elem" value="Next PAGE" onclick="if(typeof bf_htmltextareainit != 'undefined'){ bf_htmltextareainit() }populateSummarizers();if(document.getElementById('bfPaymentMethod')){document.getElementById('bfPaymentMethod').value='';};ff_validate_nextpage(this,'click');return false;" type="submit" name="ff_nm_nextpage1[]" id="ff_elem961"><span>Next PAGE</span></button>
Thanks-
Sam
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
leakim971 - thanks! great documentation too.
Unfortunately I can't use ID this time... can you please modify that to be specific to the button with class ff_elem and has a name that begins with "ff_nm_next" so this will work for name="ff_nm_nextpage1" and name="ff_nm_nextpage2 etc..
Unfortunately I can't use ID this time... can you please modify that to be specific to the button with class ff_elem and has a name that begins with "ff_nm_next" so this will work for name="ff_nm_nextpage1" and name="ff_nm_nextpage2 etc..
ASKER
I tried
JQuery( "input[name^='ff_nm_next']" ).addClass("bfNextButton");
but that didn't seem to work...
ASKER
Got it:
JQuery( "button[name^='ff_nm_next']" ).addClass("bfNextButton");
ASKER
I think that will add the class to all ff_elem buttons; can you please modify that to be specific to the button with class ff_elem and has a name that begins with "ff_nm_next" so this will work for name="ff_nm_nextpage1" and name="ff_nm_nextpage2 etc..
Also, how would I replace the class instead of adding it? (i.e 2 different scenarios)
Thanks again