When we build the form for any input then its required to validate the form before we submit form to the server. We required the variety of the validation like text box validation for input character in jquery, check box selection validation jquery and dropdown validation in jquery.

we can do it both client side and server side validation. But in this tutorial i write dropdown validation in JQUERY. Here i am writing the tutorial about how to validate the dropdown box using jquery in simple one if condition.

dropdown validation in jquery

First we need to know how to get the value of the selected dropdown in jquery. See the syntax display below:


$(“#DDID option:selected”).val()

In above syntax DDID is the id of the dropdown which we have assigned to the dropdown control which you are going to validate. Now we need to check the dropdown selected value is same as the default value of the dropdown then we display message to select the dropdown value.

See the example below:

<select name=”country”  id=”country”  >
<option selected=”selected”  value=”Select Country”>Select Country</option>
<option value=”1″ >England</option>
<option value=”2″ >India</option>
<option value=”3″ >Usa</option>


Now in above example we need to check the dropdown value is Select Country or other using the jquery.

if($(“#country option:selected”).val()==”Select Country ” )
$(“#errorMsg”).text(“please select country .”);
return false;


In above jquery, we have checked the dropdown value is Select Country then we display the message or we can alert the message by using the alert method. If you think about the full example and can work easy for you then please copy and paste the below example into the html page and run it in browser.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>
<html xmlns=””>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Dropdown Validation In Jquery</title>
<script src=”” type=”text/javascript”></script>
body{ font-family:Verdana, Geneva, sans-serif}

<div style=”width:450px;height:200px;margin:auto;padding:50px;border:solid 1px #999;”>
<form   onsubmit=”return submitform(this);”>
<h2>Dropdown Validation In Jquery</h2>
<p> <select name=”country”  id=”country”  >
<option selected=”selected”  value=”Select Country”>Select Country</option>
<option value=”1″ >England</option>
<option value=”2″ >India</option>
<option value=”3″ >Usa</option>
</select> </p>
<p><input type=”submit” value=”Submit”></p>
<script type=”text/javascript” language=”JavaScript”>

function submitform()
if($(“#country option:selected”).val()==”Select Country” )
alert(“please Select Country.”);
return false;
return true;

return false;



If you like the above tutorial for the basic learning and want to learn more this kind of tutorial, visit the following link to find the more tutorials related to jquery. 
Best Free Jquery Tutorial Links

Kalpesh Patel

Founder & Owner at Aarav Web Solutions . Working for business development related to Web Design & Development. Also working with client in India & for outsourcing projects. Visit our website Aarav Web Solutions to see more about completed projects for clients. Focus in product development and we have developed our two own product listed below: Classified Website In India and Deals & Offer Website In India