6

I tried to integrate Bootstrap3 with the awesome x-editable and typeahead.js, but I couldn't make it work:

I tried the following

  • mark the element with data-type='typeaheadjs'
  • add type='typeaheadjs' to $().editable()
  • move all parameters to data-* attributes
  • move all parameters to $().editable() arguments

but no luck.

HTML Code:

<div style="margin: 150px">
    <a href="#" id="username">Rome</a>
</div>

JS Code:

$('#username').editable({
    mode: 'inline',
    showbuttons: false,
    type: 'text',
    url: '/post',
    pk: 1,
    title: 'Enter an Italian city',
    typeahead: {
        local: ['Rome', 'Milan', 'Venice', 'Florence']
    }
});        

fiddle here: http://jsfiddle.net/Ggxbm/3/

even the provided example at http://vitalets.github.io/x-editable/docs.html#typeaheadjs does not work for me

What am I doing wrong?

4

1 回答 1

5

您需要包括 typeahead.min.js和 typeaheadjs.js

正如你在这个小提琴http://jsfiddle.net/9q7Jd/1/中看到的那样

http://cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/inputs-ext/typeaheadjs/typeaheadjs.js

正在解决问题。

您可以在目录inputs-ext/typeaheadjs的 zip 存档中找到 typeaheadjs.js : https ://github.com/vitalets/x-editable/tree/master/src/inputs-ext/typeaheadjs

于 2013-12-31T10:45:18.953 回答