Select2 Event for creating a new tag

前端 未结 3 1203
闹比i
闹比i 2021-01-01 15:58

I\'m using the jQuery Select2 (v4) plugin for a tag selector.

I want to listen for when a new tag is created in the select element and fire an ajax request to store

3条回答
  •  醉话见心
    2021-01-01 16:14

    The only event listener that worked for me when creating a new tag was:

    .on("select2:close", function() {
     (my code)
    })
    

    This was triggered for new tags and selecting from the list. change, select2:select, select2:selecting and any others did not work.

提交回复
热议问题