How to change default options in jquery.mentionsInput (jquery plugin)?-Collection of common programming errors

How to change default options in jquery.mentionsInput (jquery plugin)

(function ($, _, undefined) {

  // Settings
  var defaultSettings = {
    triggerChar   : '@',
    onDataRequest : $.noop,
    minChars      : 2,
    showAvatars   : true,
    elastic       : true,
    classes       : {
      autoCompleteItemActive : "active"
    },
    templates     : {
      wrapper                    : _.template(''),
      autocompleteList           : _.template('')
    }
  };
....

How to set an other triggerChar value from

  $('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' }
      ];
    }
  });
  1. From the docs you set triggerChar e.g.

    $('textarea.mention, input.mention').mentionsInput({
    
      onDataRequest: function(){},
      triggerChar: '#'
    });
    

Originally posted 2013-11-09 21:10:40.