Bootstrap-select - how to fire event on change

后端 未结 6 1402
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 09:30

I\'m using Bootstrap 3.0.2 and the Bootstrap-select plugin.

Here\'s my select list:



        
6条回答
  •  遥遥无期
    2020-12-08 10:05

    My implementation

    import $ from 'jquery';
    
    $(document).ready(() => {
      $('#whatDescribesYouSelectInput').on('change', (e) => {
        if (e.target.value === 'Other') {
          $('#whatDescribesYouOtherInput').attr('type', 'text');
          $('#specifyLabel').show();
        } else {
          $('#whatDescribesYouOtherInput').attr('type', 'hidden');
          $('#specifyLabel').hide();
        }
      });
    });
    

提交回复
热议问题