remove & add select box option if other selection changes

后端 未结 3 970
夕颜
夕颜 2021-01-26 10:12

I have 3 select boxes and all are having same value (clones) & created on change of reference table selection. now i want to manage the selection on the three Constraint d

3条回答
  •  无人共我
    2021-01-26 10:48

    I have updated the code. This is what you are looking for

    $('select').change(function() {
      if ($(this).val() == 'other') {
        $('#select1, #select2, #select3').not(this)
          .children('option[value="other"]')
          .remove()
      } else {
        if ($('#select1, #select2, #select3').not(this).find('option[value=other]').length > 0) {
    
        } else {
    
          ($('#select1, #select2, #select3').not(this)
            .append(''))
        }
      }
    });
    
    
    
    
    

    http://jsfiddle.net/dZqEu/2003/

提交回复
热议问题