Home >>jQuery Tutorial >jQuery radio Selector

jQuery radio Selector

jQuery radio Selector

jQuery radio selector in jQuery is used to selects input elements with type=radio.

Syntax:
$(":radio")
Here is an Example of jQuery :radio Selector

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(":radio").wrap("<span style='background-color:#c0ed1f'>");
});
</script>
</head>
<body>
<form action="">
Name: <input type="text" name="user"><br>
Male:<input type="radio" name="sex" value="m"><br>
Female<input type="radio" name="sex" value="f"><br>
<input type="submit">
</form>
</body>
</html>

Output:
Name:
Male:
Female