I have problem with the else block. The if block works well – when the value of #finish_day is less then 4, the options values in #get_car and #return_car (select) are the same.
I can change the option in #get_car and in #return_car automatically and only one is active (the same as in #get_car).
Unfortunately when value in #finish_day is greater then 4 (else block) I can’t activate options in #return_car – still only one option is active and rest is disabled.
This is my code:
if ( $("#finish_day").val() < 4 ) {
$('#get_car, #return_car').not(this)
.children('option[value=' + this.value + ']')
.attr('selected', true)
.siblings().attr('disabled', true);
} else {
$('#get_car, #return_car').attr('selected', false);
}
I don’t know what’s wrong? I will be grateful for any help.
Try the following: