boostrap选择搜索不工作

时间:2017-02-13 14:14:02

标签: javascript jquery

尝试使用bootstrap-select

时出现data-live-search错误

使用github引用的最新版本

<link rel="stylesheet" href="/static/css/bootstrap-select.css">

<script src="/static/js/bootstrap-select.js"></script>

和表格

    <select class="selectpicker float-bottom country-residence" data-live-search="true">
      <option value="">{{ profile.country|default:"----Select One----" }}</option>
      {% for co in countries %}
        <option value="{{ co.0 }}">{{ co.1 }}</option>
      {% endfor %}
    </select>

错误消息

Uncaught TypeError: Cannot read property '3' of undefined
    at $.expr.pseudos.icontains (bootstrap-select.js:199)
    at jquery.js:15
    at jquery.js:15
    at jquery.js:15
    at bm (jquery.js:15)
    at bm (jquery.js:15)
    at Z (jquery.js:15)
    at Function.Z.matches (jquery.js:15)
    at Function.filter (jquery.js:15)
    at bj (jquery.js:15)

bootstrap-select 195-200

// Case insensitive contains search
$.expr.pseudos.icontains = function (obj, index, meta) {
  var $obj = $(obj);
  var haystack = ($obj.data('tokens') || $obj.text()).toString().toUpperCase();
  return haystack.includes(meta[3].toUpperCase());
};

record-preview错误

0 个答案:

没有答案
相关问题