最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - x-editable + bootstrap 3 + Twitter typeahead.js not working - Stack Overflow

programmeradmin0浏览0评论

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: /

even the provided example at .html#typeaheadjs does not work for me

What am I doing wrong?

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/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?

Share Improve this question edited Aug 5, 2014 at 3:06 casperOne 74.6k19 gold badges189 silver badges260 bronze badges asked Oct 28, 2013 at 14:21 silentman.itsilentman.it 3616 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

You need to include typeahead.min.js AND typeaheadjs.js

as you can see in this fiddle http://jsfiddle/9q7Jd/1/ adding

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

is fixing the issue.

you can found typeaheadjs.js in the zip archive in directory inputs-ext/typeaheadjs : https://github./vitalets/x-editable/tree/master/src/inputs-ext/typeaheadjs

发布评论

评论列表(0)

  1. 暂无评论