Не совсем JQuery, но я сделал функцию в JavaScript, которая настраивает раскрывающиеся списки форм в соответствии с количеством дней для данной комбинации месяц / год, в раскрывающихся списках будет первая запись в качестве описания*
<select name="reg_day" id="reg_day">
<option>Day</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select name="reg_month" id="reg_month">
<option>Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
</select>
<select name="reg_year" id="reg_year">
<option>Year</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
</select>
Функция
function calculateDays(){
//get the day, month, year drop downs
var dayBox = document.getElementById('reg_day');
var monthBox = document.getElementById('reg_month');
var yearBox = document.getElementById('reg_year');
if(monthBox.value>0){
if(yearBox.value<1800){
var year = new Date().getFullYear();
} else {
var year = yearBox.value;
}
var daysThisMonth = 32 - new Date(year, (monthBox.value-1), 32).getDate();
} else {
var daysThisMonth = 31;
}
//save the first one, and the selected index
var dayBoxText = dayBox.options[0].text;
var dayBoxSelected = dayBox.selectedIndex;
//clear the drop down (days)
for(var count = dayBox.options.length - 1; count >= 0; count--){
dayBox.options[count] = null;
}
//create the first option (ie the bit that says Day, Month, Year)
var theOption = new Option;
theOption.text = dayBoxText;
dayBox.options[dayBox.options.length] = theOption;
//populate the days drop down with the new lists
for(var i = 1; i <= daysThisMonth; i++) {
var theOption = new Option;
theOption.text = i;
theOption.value = i;
dayBox.options[dayBox.options.length] = theOption;
}
//if the day selected is less than days use choose the last, if not choose the selected index
if(dayBoxSelected<daysThisMonth){
dayBox.selectedIndex = dayBoxSelected;
} else {
dayBox.selectedIndex = dayBox.options.length-1;
}
}