Input Radio autofocus Attribute

Definition and Usage

autofocus Set or return whether the radio button should automatically gain focus when the page is loaded.

This property reflects the HTML autofocus attribute.

See also:

HTML Reference Manual:HTML <input> autofocus Attribute

Example

Find out if the radio button will automatically gain focus when the page is loaded:

var x = document.getElementById("myRadio").autofocus;

Try it yourself

Syntax

Return the autofocus attribute:

radioObject.autofocus

Set the autofocus attribute:

radioObject.autofocus = true|false

attribute value

value description
true|false

Specifies whether the radio button should gain focus when the page is loaded

  • true - The radio button gains focus
  • false - Default. The radio button does not gain focus

Technical Details

Return value: Boolean value, returned if the radio button automatically gains focus when the page is loaded true; otherwise return false.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support