Typeahead在bootstrap标签中不起作用

时间:2014-06-06 08:29:44

标签: twitter-bootstrap bootstrap-typeahead twitter-bootstrap-2 yii2 bootstrap-tags-input

我的bootstrap标记字段不能与typehead一起使用。我的bootstrap版本是2.3,我在yii2框架中工作。

HTML:

  <input type="text" id="tags"
         value="<?php echo   $model->tags;?>"/>   

脚本:

  var colors = ["red", "blue", "green", "yellow", "brown", "black"];
  $('input[type=text][id="tags"]').tagsinput({
  typeahead: {
  source: function(query) {
  return colors;
  }
  }
  });

ERROR

   TypeError: text is undefined

   matcher()bootst...nput.js (line 278)
   text = undefined
    transition()bootstrap.min.js (line 6)
    a = undefined
    f()jquery.min.js (line 2)
    a = function()
    b = function()
    c = false
    transition()bootstrap.min.js (line 6)
    b = undefined
    transition()bootstrap.min.js (line 6)
    a = Object { originalEvent=Event keyup, type="keyup", timeStamp=16416032, more...}
    (?)()analyse?id=3 (line 2)
    H()jquery.min.js (line 3)
    c = Object { originalEvent=Event keyup, type="keyup", timeStamp=16416032, more...}
    H()jquery.min.js (line 3)
    a = keyup charCode=0, keyCode=82

    return (text.toLowerCase().indexOf(this.query.trim().toLowerCase()) !== -1);

有什么想法吗?

0 个答案:

没有答案