How to change class name of a button

Posted by stackOver Flow on Stack Overflow See other posts from Stack Overflow or by stackOver Flow
Published on 2014-08-19T09:40:52Z Indexed on 2014/08/19 10:20 UTC
Read the original article Hit count: 126

Filed under:
|
|

I have four buttons like this

<div class="btn-group">
  <button id="btn-men"  class="btn btn-default active" 
             i18n:translate="men">Men</button>
  <button id="btn-women" class="btn btn-default" i18n:translate="women">Women</button>
  <button id="btn-kids" class="btn btn-default" i18n:translate="kids">Kids</button>
 </div>  

And I have different css styles for the class "btn btn-default active" and "btn btn-default". what I want to know is if there is any way of changing the class name of the clicked button as btn btn-default active from btn btn-default and also change the unclicked button as btn btn-default during run time.

I also use i18n for mulitilingual purpose.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery