jQuery Selector :radio

Introduction

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

Syntax

$(":radio")

Select all <input> elements with type="radio":

View in separate window

<!DOCTYPE html>
<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:red'>");
});/*www.  j av  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>



PreviousNext

Related