Michael Lam
asked on
How to check if you are clicking on a radio buttons that's already selected
I have several rows of twin radio buttons that are generated via a loop in ruby on rails. For each row, one of the button is already selected, how do i detect if the user accidentally click on a radio button that's already selected? Keep in mind these buttons all have generated ids so I can just look for a specific id. Can someone show me how to do this via ruby on rails or javascript? Thanks.
This is not a helpful answer:
Why do you need to know if someone clicks on a selected radio button?
Why do you need to know if someone clicks on a selected radio button?
ASKER
I need to know that so when the user clicks on a radio button that's already selected, I can ignore it. Otherwise it will considered that a change and make a call to the backend to update the "change". Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Unfortunately this doesn't work for IE8,9,10 due to the change event bug on IE. So I have to use onClick event.
I have no access to IE on my systems. I'll have to leave it for someone else to answer.
https://jsfiddle.net/ta17qkeq/