質問

I am using MagicSuggest ( http://nicolasbize.github.io/magicsuggest/ ) in my app. Everything displays and functions perfect, but for whatever reason, the values are not displayed no matter what I try!

Can anybody explain to me what is wrong with that code??

$("#klip-tags").magicSuggest({
    width: "93%",
    displayField: "name",
    value: [15,19],
    data: [{id:19,name:"javascript"},{id:15,name:"joomla"},{id:20,name:"jQuery"},{id:21,name:"php"}],
    useTabKey: true,
    emptyText: "Add your tags",
    resultAsString: true,
    maxSelection: 8,
    name: "klip_tags"
});

No console errors, no nothing! They just refuse to show up!

役に立ちましたか?

解決

This can happen, if you attach MagicSuggest to an input element declared with a value attribute.

Explanation:

This will not work:

<input type="text" name="klip_tags" id="klip-tags" value="" />

This will not work:

<input type="text" name="klip_tags" id="klip-tags" value="joomla,javascript" />

This will work:

<input type="text" name="klip_tags" id="klip-tags" />
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top