<!DOCTYPE html>
<
head
>
<
title
>
How to check a radio button
with jQuery?
</
title
>
<
script
src
=
</
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").prop("checked", true);
});
$(".check-premium").click(function () {
$("#premium").prop("checked", true);
});
$(".reset").click(function () {
$("#free").prop("checked", false);
$("#premium").prop("checked", false);
});
});
</
script
>
</
body
>
</
html
>