2016-10-25 16 views
0

私はselect2 4.0.0を使用していますが、削除するアイテムの値を取得したいのですが、これを行うにはselect2-removedイベントを使用しようとしていますが、動作しません。Select2を削除したイベントが発生しませんか?

どうすればいいですか?

お試しください。

$(document).ready(function() { 
    $('#selectedItems').on('select2-removed', function (e) { 
     console.log(e.val); 
    }).select2({ 
     placeholder: "Select an option" 
    }); 
}); 

答えて

0

私は

$(document).ready(function() { 
    $('#selectedItems') 
     .on('select2:unselect', function (e) { 
      console.log(e.params.data.id); 
     })   
     .select2({ 
      placeholder: "Select an option" 
    } ); 

}); 
をした

を望んでいたまさに見つけ

関連する問題