jQuery Examples - $(":radio")
Description
"$(":radio")" Selects all radio buttons in the form.
Syntax
Here is the simple syntax to use this selector −
$(":radio")
Parameters
Here is the description of all the parameters used by this selector −
:radio − radio button selector
Returns
This selector returns an array filled with the found radio elements.
Example
<html>
<head>
<title>The Selector Example</title>
<script type = "text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
</script>
<script type = "text/javascript" language = "javascript">
$(document).ready(function() {
/* Selects the visible <li> element..*/
$(":radio").wrap( "<span></span>" ).parent().css("background-color", "yellow");
});
</script>
</head>
<body>
<form>
<table>
<tr><td>Name</td><td><input type = "text"></td></tr>
<tr><td>Password</td><td><input type = "password"></td></tr>
<tr><td>Gender</td>
<td><input type = "radio" name = "gender" value = "male">Male<br>
<input type = "radio" name = "gender" value = "female">Female</td>
</tr>
</table>
</form>
</body>
</html>
This will produce following result −
jqueryexamples_selectors.htm
Advertisements