Set default selection to Magic suggest

懵懂的女人 提交于 2019-11-28 09:00:45

问题


I have a Magic suggest box in my application. For that I want to set default selected values. I have JSON object as well to bind the data. But I didn't find any option like how to make them selected.

Is there any option in Magic suggest?

Please let me know. Any help would be appreciated.


回答1:


Use the 'value' option:

$('#ms-gmail').magicSuggest({
    resultAsString: true,
    width: 590,
    value: ['john@kennedy.com'],
    data: 'marilyn@monroe.com, mother@teresa.com,...,jimmy@wales.com'
});

The above example sets the default selected value to 'john@kennedy.com'

See http://nicolasbize.github.io/magicsuggest/



来源:https://stackoverflow.com/questions/20877978/set-default-selection-to-magic-suggest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!