Search
 
SCRIPT & CODE EXAMPLE
 

HTML

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>
Comment

PREVIOUS NEXT
Code Example
Html :: how to clear radio button input when someone types in an input field 
Html :: difernce between innertextand neer html 
Html :: django base html 
Html :: bootstrap grids examples 
Html :: if angular 
Html :: img src data base64 
Html :: yii2 csrf custom form 
Html :: router link @click 
Html :: how to create accordion effect using built-in HTML tags? 
Html :: display html input datetime-local value 
Html :: bootstrap 4 spinner not showing 
Html :: placeholder in input field MVC 
Html :: browser favicon html 
Html :: convert ipynb to html 
Html :: htmladjacent 
Html :: insérer pdf dans html 
Html :: class vs id in html 
Html :: .html to .exe 
Html :: html image in table 
Html :: html js make dropdown list checkbox 
Html :: how to set logo on site tab 
Html :: html qr code generator 
Html :: index.html favicon.ico 404 (Not Found) 
Html :: bootstrap news template 
Html :: elements should have autocomplete attributes 
Html :: html a 
Html :: html css good button 
Html :: tailwind flex shrink 
Html :: html how to move element to the bottom right of page 
Html :: html script element 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =