20

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>
Joe
  • 2,551
  • 6
  • 38
  • 60
  • Please share code you've tried, and/or links to the plugin. – Jason M. Batchelor Feb 07 '14 at 22:47
  • There is no code. OP wants to know how to change the "Add..." text that appears when you implement this plugin for adding to existing lists, tags etc. See the demo page on github.. – Shiva Feb 07 '14 at 23:22
  • 1
    answer is here: https://github.com/brianreavis/selectize.js/blob/master/docs/usage.md#rendering – maciek Sep 17 '14 at 13:24

1 Answers1

50

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>';
    }
  },
Joe
  • 2,551
  • 6
  • 38
  • 60