Radio.focus()

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

							radio.focus()

Description

The focus() method of the Radio object sets the focus to the radio button.

Example

Listing 7.435 shows how the focus() method is used.

Listing 7.435 Example of the focus() Method
<html>
<head>
<title> Example of the radio focus method</title>
</head>
<body>

<form name="form1">
<input type="radio" name=button1>Box 1
<br>
<input type="radio" name=button2>Box 2
<br><br>
<input type="button" value="Set Focus to Box 1" onClick='document.form1.button1.focus()'>
</form>

</body>
</html>
							
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.