Hi there

I have a set of radio buttons each with an onclick event that has a numeric value. When the button is clicked an input box called "Total" is updated with the new value. The problem I'm having is that if a radio button is checked and one clicks on it again then the onclick event is triggered.

Is there any way to prevent the onclick event from triggering if the radio button is already checked?

Recommended Answers

All 2 Replies

when a radio button is clicked remove its onclick event and when you click on another radio button restore its onclick event

mate, use focus instead of click so you can check for if(this.checked)

Hi there

I have a set of radio buttons each with an onclick event that has a numeric value. When the button is clicked an input box called "Total" is updated with the new value. The problem I'm having is that if a radio button is checked and one clicks on it again then the onclick event is triggered.

Is there any way to prevent the onclick event from triggering if the radio button is already checked?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.