$('select[name=adults]').bind('change', function() {
var $value = $(this).val();
if ($value >= 1) {
var html = '';
for (i = 1; i <= $value; i++) {
html = html + '<option value="' + i + '">' + i + '</option>';
}
$('select[name=infants] option').each(function() {
if ($(this).val() > 0) {
$(this).remove();
}
});
$(html).appendTo('select[name=infants]')
} else {
var html = '';
html = html + '<option value="0">0</option>';
html = html + '<option value="1">1</option>';
$(html).appendTo('select[name=infants]')
}
});

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案