jQuery – :radio Selector

The jQuery radio selector selects all elements of type radio. jQuery(‘:radio’) is equivalent to jQuery(‘[type=radio]‘) or jQuery(‘input:radio’)

Source Code

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div class="div1">
<label>Radio Button : </label><input type="radio" />
</div>
<button>Click Here</button>

  
<script>
jQuery("button").click(function () {
	jQuery("div.div1 > :radio").wrap('<span></span>').parent().css({border:"3px #1E8CBE solid"});
});
</script>
</body>
</html>

Demo

Following example finds all radio inputs and create a border.

,

No comments yet.

Leave a Reply