Jquery 令牌输入 - allowCustomEntry 不起作用

我正在使用 Jquery Token Input 版本 1.6.0.我希望能够在令牌输入中输入自定义条目,但每次我这样做时都会提交表单(我输入自定义单词并按 Enter).这是我的代码(在咖啡脚本中):

I am using Jquery Token Input version 1.6.0. I would like to be able to enter custom entries into the token-input, but everytime I do so the form submits (I type a custom word and hit enter). Here is my code (in coffeescript):

jQuery ->
    $('[id$=tag_list_tokens]').each ->
        el = $(this)
        el.tokenInput '/listings/tags.json',
            theme: 'facebook'
            minChars: 1
            allowCustomEntry: true
            preventDuplicates: true
            prePopulate: el.data('load')
            allowFreeTagging: false

除了自定义条目外,一切正常……知道我做错了什么吗?

Everything works fine except for the custom entries...any idea what I'm doing wrong?

推荐答案

allowFreeTagging 1.6.0 版本未实现.从 Github 下载 v1.6.1.(TokenInput 网站已经过时了几年.)

allowFreeTagging wasn't implemented by version 1.6.0. Download v1.6.1 from Github. (The TokenInput website is a few years out of date.)

我想你也想设置 allowFreeTagging:true,然后废弃 allowCustomEntry.

I imagine you'll want to set allowFreeTagging:true as well, and scrap allowCustomEntry.

相关文章