Trigger an action after selection select2

前端 未结 6 1106
盖世英雄少女心
盖世英雄少女心 2020-12-07 16:30

I am using select2 library for my search.
is there any way to trigger an action after selecting a search result? e.g. open a popup, or a simple js alert.



        
6条回答
  •  没有蜡笔的小新
    2020-12-07 17:07

    There was made some changes to the select2 events names (I think on v. 4 and later) so the '-' is changed into this ':'.
    See the next examples:

    $('#select').on("select2:select", function(e) { 
        //Do stuff
    });
    

    You can check all the events at the 'select2' plugin site: select2 Events

提交回复
热议问题