Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the "Add" word on jQuery Selectize plugin?

I may have missed it in docs but I cannot find how to change the "Add" word in options. Is it possible?

@Shiva - I looked through the code on github but haven't found the answer to my question. My code is following:

<div class="sandbox" style="width: 200px">
  <input id="input-tags" class="demo-default selectized" type="text" tabindex="-1" style="display: none;">
  <div class="selectize-control demo-default multi">
    <div class="selectize-input items not-full has-options has-items" style="display:none">
      <div class="selectize-dropdown demo-default multi" style="display: none;">
      </div>
    </div>
  </div>
</div>

<script type="text/javascript">
  $(function() {
    $('#input-tags').selectize({
      valueField: 'id',
      labelField: 'name',
      searchField: 'name',
      plugins: ['remove_button'],
      createOnBlur: true,
      delimiter: ',',
      persist: false,
      hideSelected: true,
      onChange: function(input) {
        console.log(input);
      },
      create: true,
      load: function(query, callback) {
        if (!query.length)
          return callback();
        $.ajax({
          url: $('#selectizeUrl').val()+"/term/"+query,
          type: 'GET',
          dataType: 'json',
          error: function() {
            callback();
          },
          success: function(res) {
            console.log(res);
            callback(res);
          }
        });
      }

    });
  });
</script>
like image 995
Joe Avatar asked Feb 07 '14 22:02

Joe


1 Answers

I have found an answer to the question. I defined render option for selectize like that:

render: {
    option_create: function(data, escape) {
      return '<div class="create">Dodaj <strong>' + escape(data.input) + '</strong>&hellip;</div>';
    }
  },
like image 117
Joe Avatar answered Oct 17 '22 13:10

Joe