jQuery select2 control - retrieve last selected element

前端 未结 2 914
谎友^
谎友^ 2021-01-13 20:39

I am using jQuery select2 control and I need to implement the following functionality: if the user tries to add a certain element, based on some algorithm, I should delete a

2条回答
  •  无人及你
    2021-01-13 21:16

    for the second part this may help you:

    $(this).val(); // references the select
    

    you can filter it to get all needed values.

    A Example is in the fiddle: http://jsfiddle.net/jEADR/1588/

提交回复
热议问题