问题
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