如何更改jquery.mentionsInput(jquery插件)中的默认选项
(function ($, _, undefined) {
// Settings
var defaultSettings = {
triggerChar : '@',
onDataRequest : $.noop,
minChars : 2,
showAvatars : true,
elastic : true,
classes : {
autoCompleteItemActive : "active"
},
templates : {
wrapper : _.template('<div class="mentions-input-box"></div>'),
autocompleteList : _.template('<div class="mentions-autocomplete-list"></div>')
}
};
....
如何从
设置其他triggerChar值 $('textarea.mention, input.mention').mentionsInput({
onDataRequest:function (mode, query, callback) {
var data = [
{ id:1, name:'Kenneth Auchenberg', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' }
];
}
});
答案 0 :(得分:1)
从docs设置triggerChar
,例如
$('textarea.mention, input.mention').mentionsInput({
onDataRequest: function(){},
triggerChar: '#'
});