-1

I have to find that the radio button is checked or not if its clicked and checked then count will increase of its . And if count will increase then it will increase only one time. it will not increase on multiple click on same radio button in sveltekit.

enter image description here

Kindly suggest the count increment method on radio button

it will increase count when click and not increment count when multiple click on same radio button

  • 2
    Don't paste a screenshot. Please post with a minimum reproducible code. https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors – Watanabe.N Mar 30 '22 at 12:47

1 Answers1

0

I think the knowledge you are missing is likely how to determine if the radio is checked? If so, the top answer to this provides a good explanation: How can I check whether a radio button is selected with JavaScript?

Something like:

var counter = 0;
if(document.getElementById('id').checked) {
  counter++;
}else{
  counter--;
}
Sarah Vela
  • 144
  • 3