Introduction:
Here I will explain how to clear radio button selection in jQuery or reset / clear radio button list selection in jQuery with example or how to uncheck radio button list in jQuery.
Description:
In previous articles I explained jQuery get radio button list selection value, jQuery get all selected checkbox values, jQuery select or deselect checkbox values, jQuery disable right click on image and many articles related to jQuery. Now I will explain how to clear radio button selection in jQuery with example.
In previous articles I explained jQuery get radio button list selection value, jQuery get all selected checkbox values, jQuery select or deselect checkbox values, jQuery disable right click on image and many articles related to jQuery. Now I will explain how to clear radio button selection in jQuery with example.
To
clear selected radio button list we need to write the code like as shown below
<script type="text/javascript">
function ClearAge() {
$('input:radio[name=rdbage]').attr('checked', false);
}
</script>
|
If
you want complete example check below code
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Clear radio button selection</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
function ClearAge() {
$('input:radio[name=rdbage]').attr('checked', false);
}
</script>
</head>
<body>
<form id="form1">
<div>
<b>Select Age Group:</b>
<input type="radio" name="rdbage" value="10 - 15 Years" />
10 - 15 Years
<input type="radio" name="rdbage" value="15 - 30 Years" />
15 - 30 Years
<input type="radio" name="rdbage" value="30 - 50 Years" />
30 - 50 Years<br/><br/>
<input type="button" id="btnClear" value="Clear Selection" onclick="ClearAge()"
/>
</div>
</form>
</body>
</html>
|
Live Demo
If
you want to check live demo select age group and click on below button
Select Age Group: 10 - 15 Years 15 - 30 Years 30 - 50 Years |
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
0 comments :
Note: Only a member of this blog may post a comment.