:radio Selector - Javascript jQuery Selector

Javascript examples for jQuery Selector:radio

Description

The :radio selector selects input elements with type=radio.

The following code shows how to select all <input> elements with type="radio":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $(":radio").wrap("<span style='background-color:red'>");
});/*w  w  w.jav  a  2  s . c  om*/
</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>

Related Tutorials