<!DOCTYPE html>
<head>
<title>
How to check a radio
button with jQuery?
</title>
<script src=
"https://code.jquery.com/jquery-2.2.4.min.js">
</script>
</head>
<body>
<h1 style="color: green">
GeeksForGeeks
</h1>
<b>jQuery Check/Uncheck Radio Button</b>
<p>
<input type="radio" name="option" id="free">
Free Membership
<input type="radio" name="option" id="premium">
Premium Membership
</p>
<p>
<button type="button" class="check-free">
Get Free
</button>
<button type="button" class="check-premium">
Get Premium
</button>
<button type="button" class="reset">
Reset options
</button>
</p>
<script type="text/javascript">
$(document).ready(function () {
$(".check-free").click(function () {
$("#free").attr("checked", true).click();
});
$(".check-premium").click(function () {
$("#premium").attr("checked", true).click();
});
$(".reset").click(function () {
$("#free").attr("checked", false);
$("#premium").attr("checked", false);
});
});
</script>
</body>
</html>