i has the following script
<select id="select1">
<option value="1">1day</option>
<option value="2">2day</option>
<option value="3">3day</option>
</select>
<select id="select2">
<option value="1">1day</option>
<option value="2">2day</option>
<option value="3">3day</option>
</select>
and jquery
$("#select2").change(function() {
var max_value = parseInt($("#select2 :selected").val());
var min_value = parseInt($("#select1 :selected").val());
if(max_value < min_value)
{
$("#select1").val($(this).val());
}
});
and now, what I can’t understand anyway - if the values of the option elements are integers, why should I use parseInt ()? in some cases, it does not work without parseInt ().
thank
Simon source
share