title: select2 - Change configuration dynamically
body: <p>I'm trying to override the <code>maximumSelectionLength</code> configuration option in <code>select2</code> dynamically if the user chose the first option, I tried to do it as follows...</p>
  
  <pre><code>$(".some-div select").on("select2:open", function(e) {
  
      if(e.target.options[0].selected) {
          $(this).select2({
             maximumSelectionLength: 1
          });
      }
  
  });
  </code></pre>
  
  <p>But it always gives me this error <code>Uncaught TypeError: Cannot read property 'query' of null</code></p>
  
  <p>How can I do that?</p>