jQuery Validation for Drop Down Box

By | October 21, 2012

Drop down box is also called as combo box, select box.
jQuery validation for drop down box (select box) is some what complicated when compared to text box validation, because in select box( combo box) more than one values are placed in between <select> tag.

 $(#year option:selected).val(); – gets the value of the selected drop down box value. “year” is the ID of drop down box i.e., <select>

[code type=html]

<script type=”text/javascript”
<script type=”text/javascript”>
var year = $(#year option:selected).val();
if(year == “”)
$(“#msg”).html(“Please select a year”);
return false;
<div id=”msg”></div>
<form method=”post” action=””>
<select id=”year”>
<option>1990 </option>
<option>1991 </option>
<option>1992 </option>
<option>1993 </option>
<option>1994 </option>
<option>1995 </option>

<input type=”submit” name=”submit” id=”submit”>



2 thoughts on “jQuery Validation for Drop Down Box

  1. Mike

    Hi thanks for sharing your idea, I am having a problem with your code. I copied it into my local server and in my folder I included jqueryfile only and its not working, is there anything wrong I am doing, thanks in advance


Leave a Reply

Your email address will not be published. Required fields are marked *