Web/API/RadioNodeList/value

From Get docs


If the underlying element collection contains radio buttons, the RadioNodeList.value property represents the checked radio button. On retrieving the value property, the value of the currently checked radio button is returned as a string. If the collection does not contain any radio buttons or none of the radio buttons in the collection is in checked state, the empty string is returned. On setting the value property, the first radio button input element whose value property is equal to the new value will be set to checked.

Syntax

value = radioNodeList.value;
radioNodeList.value = string;

Example

HTML

<form>
  <label><input type="radio" name="color" value="blue">Blue</label>
  <label><input type="radio" name="color" value="red">Red</label>
</form>

JavaScript

// Get the form
const form = document.forms[0];

// Get the form's radio buttons
const radios = form.elements['color'];

// Choose the "red" option
radios.value = 'red';

Result

Specifications

Specification Status Comments
HTML Living StandardThe definition of 'RadioNodeList.value' in that specification. Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
value Chrome

Full support 34

Edge

Full support 18

Firefox

Full support 33

IE

Full support Yes

Opera

Full support Yes

Safari

Full support 10

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 33

Opera Android

Full support Yes

Safari iOS

Full support 9

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support


See also