Radio button validation in jquery

Today, We want to share with you radio button validation in jquery.In this post we will show you radio button validations in jquery for gender, hear for how to validate dropdownlist in jquery on button click we will give you demo and example for implement.In this post, we will learn about How To Set Radio Button Checked Validations In Javascript? with an example.

jQuery Validation for Radio Button and Check Box

Example 1: index.html

<script src=""></script>
<script type="text/javascript">
var gender=$('#gender').val();
var color=$('#color').val();
if ($("#gender:checked").length == 0){
$('#dis').slideDown().html('<span id="error">Please choose gender</span>');
return false;
if ($("#color:checked").length == 0){
$('#dis').slideDown().html('<span id="error">Please choose color</span>');
return false;

<style type="text/css">
height: 25px;
width: 250px;
float: left;

<fieldset style="width:290px;">
<form method="POST" action="">
<label id="dis" style="width:250px;"></label><br>

<div id="tex">Gender:</div>
<input type="radio" name="gender" id="gender"> Male
<input type="radio" name="gender" id="gender"> Female<br>

<div id="tex">Color:</div>
<input type="checkbox" name="color[]" id="color"> Green
<input type="checkbox" name="color[]" id="color"> Blue
<input type="checkbox" name="color[]" id="color"> Blue

<center><input type="submit" name="submit" id="submit" /></center>

I hope you get an idea about checkbox validation in jquery.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Also Read This 👉   Remove ALL white spaces from text Example