select2中是否有任何选项可以检查用户正在搜索哪个元素?

时间:2019-06-22 05:59:18

标签: jquery-select2

我正在使用select2 v3.5.3,我想知道是否有一个选项可以检查哪个元素正在更改

我试图获取$(this)的元素信息,但没有信息,我也已经检查了文档,但似乎对此没有选择

        allowClear: true,
        ajax: {
            url: '/request/filter_results/',
            dataType: 'json',
            quietMillis: 250,
            data: function (term, page){
                console.dir($(this));
                return {
                    q: term, // search term
                    field_selected: $(this).attr('data-field')
                };
            },```

It should return the id of the element, i.e. if I'm writing inside the element id_one it should send this info to the server

0 个答案:

没有答案
相关问题