I’ve been working on a form element replacement script – replacing normal form elements with divs that can be styled – but I’ve run into an issue with radio buttons. I cannot figure out how to remove a checked replacement button’s “selected” class when another button is selected.
I’ve included my code in this fiddle:
http://jsfiddle.net/zumwalt/eEvPE/3/
Any help is greatly appreciated!
You just need to add the following line in your click handler to clear the
selectedclass from all radios, before adding it to the one which was clicked:Updated fiddle here