Affichage des articles dont le libellé est Getting and Removing Button Classes. Afficher tous les articles
Affichage des articles dont le libellé est Getting and Removing Button Classes. Afficher tous les articles

mercredi 4 février 2015

Getting and Removing Button Classes

I have a project that contains a segmented button. Upon initialization, the first button gets assigned a class of 'lastPressed'. Each time one of the segmented buttons are toggled, I want to:


  1. Remove the 'lastPressed class from any of the buttons

  2. Add the 'lastPressed' to the pressed button




Number 1 (above) is where I am having the problem. For some reason I can't seem to be able to get the element with the 'lastPressed' class in order to remove the class. Any help?

Additionally, I want to be able to get the button that contains the 'lastPressed' class and determine its order in the array of segmentedbutton innerItems. How might I be able to accomplish this?


Here's a Fiddle for reference:






Getting and Removing Button Classes