How to check If radio button checked jQuery: In this tutorial, I am going to show you how we can check whether the radio button checked or not using Jquery.
Here, You will see the multiple ways that help you to find the radio button is checked in jquery.
Let Suppose we have radio button
<input type="radio" name="login" id="rdSelect">
1.First Method
if ($('#rdobutton').is(':checked')) {
//Perform
Action
}
2.Second Method
if ($('#rdSelect').prop('checked')) {
//Perform
Action
}
3.Third Method
$(document).ready(function () {
$('#rdSelect').click(function () {
alert('radio selected');
if ($(this).attr("checked") == "checked") {
alert("checked");
}
});
});
4.Fourth MethodIn this method, here we are using the name of checkbox
<input type="radio" name="registration" id="rdSelect">
if ($("input[name='registration']").attr("checked") == true) {
alert("checked");
}
If any of the given not working, please feel free to comment below. I hope you like this post about to check if radio button checked Jquery
Post a Comment