Avatar of SAbboushi
SAbboushiFlag for United States of America 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)

<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>

Open in new window


Thanks-
Sam
JavaScriptjQuery

Avatar of undefined
Last Comment
SAbboushi

8/22/2022 - Mon
SOLUTION
Scott Fell

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
leakim971

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
SAbboushi

thanks Padas--

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
ASKER
SAbboushi

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..
ASKER
SAbboushi

I tried
JQuery( "input[name^='ff_nm_next']" ).addClass("bfNextButton");

Open in new window

but that didn't seem to work...
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER
SAbboushi

Got it:
JQuery( "button[name^='ff_nm_next']" ).addClass("bfNextButton");

Open in new window