【问题标题】:How to get list of input in select2 multiple tags如何在select2多个标签中获取输入列表
【发布时间】:2019-10-07 09:48:40
【问题描述】:

我想获取我在 select2 输入框中输入的电子邮件 ID 列表。 这是我的看法
UI of my select2

我想获取我在输入框中输入的电子邮件列表,然后我想在 ajax 调用中发送。

这是我的 HTML

<div class="col-9">
  <div class="input-holder">
        <select class="mail-input select-2-input" multiple="multiple">
        </select>
    </div>
</div>

这是我的 js

 $(".select-2-input").select2({
    tags : true,
    placeholder : "Enter Business Email",
    tokenSeparators : [ ',', ' ' ]
})

【问题讨论】:

    标签: javascript html json ajax jquery-select2


    【解决方案1】:

    从select2中获取数据

    console.log($(".select-2-input").select2('data'));
    

    获取价值

    console.log($(".select-2-input").select2("val"));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-07
      • 2017-03-21
      • 1970-01-01
      • 2018-09-17
      • 1970-01-01
      • 2019-08-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多