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 :: styling scrollview height in react native 
Javascript :: Your global Angular CLI version is greater than your local version 
Javascript :: convert english number to bangla 
Javascript :: how to remove cors error from node app 
Javascript :: jquery show for 5 seconds 
Javascript :: remove special characters regular expression 
Javascript :: add background image to div using jquery 
Javascript :: javascript change attribute 
Javascript :: js remove the last character of a string 
Javascript :: js get first object value 
Javascript :: class onclick jqery 
Javascript :: jquery after seconds 
Javascript :: JSONStringify c# 
Javascript :: browserrouter current path 
Javascript :: checkbox on click jquery select all 
Javascript :: wrap text react native 
Javascript :: jquery delete request 
Javascript :: history.push in nextjs 
Javascript :: vue npx 
Javascript :: string to url javascript 
Javascript :: clear ctx canvas with javascript 
Javascript :: base64 decode javascript 
Javascript :: js push if not exists 
Javascript :: trim comma in javascript 
Javascript :: javascript count occurrences of letter in string 
Javascript :: firstElementChild jquery equivalent 
Javascript :: how to get file name in directory node js 
Javascript :: keyboard arrow event handling javascript 
Javascript :: clz32 
Javascript :: track window size jquery 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =