Answers for "radio button function"

0

onclick on radio button

Hi, I think all of the above might work. In case what you need is simple, I used:

<body>
    <div class="radio-buttons-choice" id="container-3-radio-buttons-choice">
        <input type="radio" name="one" id="one-variable-equations" onclick="checkRadio(name)"><label>Only one</label><br>
        <input type="radio" name="multiple" id="multiple-variable-equations" onclick="checkRadio(name)"><label>I have multiple</label>
    </div>

<script>
function checkRadio(name) {
    if(name == "one"){
    console.log("Choice: ", name);
        document.getElementById("one-variable-equations").checked = true;
        document.getElementById("multiple-variable-equations").checked = false;

    } else if (name == "multiple"){
        console.log("Choice: ", name);
        document.getElementById("multiple-variable-equations").checked = true;
        document.getElementById("one-variable-equations").checked = false;
    }
}
</script>
</body>
Posted by: Guest on February-04-2021
0

radio button

<div class="custom-control custom-radio">
  <input type="radio" id="customRadio1" name="customRadio" class="form-check-input" checked>
  <label class="form-check-label" for="customRadio1">Custom radio</label>
</div>

<div class="custom-control custom-radio">
  <input type="radio" id="customRadio2" name="customRadio" class="form-check-input">
  <label class="form-check-label" for="customRadio2">Custom radio</label>
</div>

<div class="custom-control custom-radio">
  <input type="radio" id="customRadio3" name="customRadio2" class="form-check-input" checked disabled>
  <label class="form-check-label" for="customRadio3">Custom radio</label>
</div>

<div class="custom-control custom-radio">
  <input type="radio" id="customRadio4" name="customRadio2" class="form-check-input" disabled>
  <label class="form-check-label" for="customRadio4">Custom radio</label>
</div>
Posted by: Guest on May-09-2021

Code answers related to "radio button function"

Browse Popular Code Answers by Language