Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get radio button value javascript

document.querySelector('input[name="rate"]:checked').value;
Comment

get value of radio button javascript

document.querySelectorAll('input[name="gender"]:checked').value;
Comment

Set radio button value using JavaScript

<!DOCTYPE html>
<html>
<body>
<p>Set radio button value using JavaScript</p>
Married: <input type="radio" id="radiomarried">
Unmarried: <input type="radio" id="radioUnmarried">
<p>Click the "Try it" button to check the radio button.</p>
<button onclick="selectTheMariedButton()">Click if you are maried</button>
<button onclick="selectTheUnmariedButton()">Click if you are not maried</button>
<script>
function selectTheMariedButton() {
var x = document.getElementById("radiomarried");
x.checked = true;
alert("Married is selected");
}
function selectTheUnmariedButton() {
var y = document.getElementById("radioUnmarried");
y.checked = true;
alert("Unmarried is selected");
}
</script>
</body>
</html>
Comment

JavaScript get or set radio button value

<!DOCTYPE html>
<html>
<body>
<p>Retrieve Get radio button selected value using JavaScript</p>
<p>Select the gender:</p>
<input type="radio" name="Gender" onclick="myFunction(this)" value="Male">Male<br>
<input type="radio" name="Gender" onclick="myFunction(this)" value="Female">Female<br>
<script>
function myFunction(Gender) {
alert(Gender.value);
}
</script>
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: chart.js label word wrap 
Javascript :: jquery force page to reload on viewport resize 
Javascript :: jquery active menu 
Javascript :: javascript wait async 
Javascript :: mongodb $in regex 
Javascript :: typeorm findone subquery 
Javascript :: javascript number length 
Javascript :: Cookies In NodeJS 
Javascript :: array map limit javascript 
Javascript :: jquery navigation 
Javascript :: js clear all select options 
Javascript :: angular stoppropagatio 
Javascript :: collapse uncollapse jquery 
Javascript :: flask return status code 200 and json 
Javascript :: reverse words in a string javascript 
Javascript :: count value a to b character javascript 
Javascript :: to lowercase js 
Javascript :: countdown timer in react js 
Javascript :: javascript long integer 
Javascript :: hmget in redis 
Javascript :: javascript two digit number 
Javascript :: why is my deleteOne mongoose middleware not working 
Javascript :: jquery change tabs 
Javascript :: how to use useparams in react 
Javascript :: how hide .html in url 
Javascript :: urlencoded limit 
Javascript :: react native keyboard event listener 
Javascript :: days array in js 
Javascript :: remove id attribute javascript 
Javascript :: .join in javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =