<select name="age_from" class="form-control">
<option value="18"
@if(old('age_from'))
{{ old('age_from') }}
@else
18
@endif
>
@if(old('age_from'))
{{ old('age_from') }}
@else 18 @endif
</option>
@for($i=19;$i<=65;$i++)
<option>{{$i}}</option>
@endfor
</select>
<select name="age_to" class="form-control">
@for($i=18;$i<65;$i++)
<option>{{$i}}</option>
@endfor
<option selected>
@if(old('age_to'))
{{ old('age_to') }}
@else
65+
@endif
</option>
</select>
答案 0 :(得分:2)
(文档)$。就绪(函数(){ $( “AGE_TO”)。变化(函数(){
var age_from =$('.age_from').val();
var age_to =$('.age_to').val();
if(age_from > age_to ){
$('.age_to').css('border-color', 'red');
$('.age_warrning').show();
}else{
$('.age_to').css('border-color', '');
$('.age_warrning').hide();
}
});
$(".age_from").change(function(){
var age_from =$('.age_from').val();
var age_to =$('.age_to').val();
if(age_from > age_to ){
$('.age_to').css('border-color', 'red');
$('.age_warrning').show();
}else{
$('.age_to').css('border-color', '');
$('.age_warrning').hide();
}
});
});