title: Select2 4.x: How to actually limit the search input?
body: <p>I refer to option <code>maximumInputLength</code>: Setting this to e.g. "5" displays a message "Please delete 3 characters" in case I enter a term of length 8. Nevertheless it's possible to enter any amount of characters.</p>
  
  <p>While this may be desired in certain situations, it differs from how <code>&lt;input type="text" maxlength="5"&gt;</code> works, as this would prevent any input of more than 5 characters.</p>
  
  <p>So in order to have a consistent behaviour within my UI my question is: How to actually <em>limit</em> the input?</p>
  
  <hr>
  
  <p>What I've tried so far: The message is generated in <code>function MaximumInputLength</code>, so I tried to override that function as explained <a href="https://stackoverflow.com/a/32117772/3890673">here</a>, but without success. I get several errors such as "options is undefined", "decorated is undefined", ... While I still assume I'll have to somehow overwrite certain things the process to do so in select2 4.x is somewhat unclear to me, so any help is appreciated</p>
  
  <hr>
  
  <p>EDIT: <a href="https://stackoverflow.com/users/2628903/velimir-tchatchevsky">velimir-tchatchevsky</a>'s <a href="https://stackoverflow.com/a/39526616/3890673">answer</a> pointed me to this workaround:</p>
  
  <pre><code>$('select').select2().on('select2:open', function() {
      $('.select2-search__field').attr('maxlength', 5);
  });
  </code></pre>
  
  <p>Kind of hacky (what if the css class changes in future releases?), so I'd prefer a different solution, but this does the job</p>