title: Select2 - Disable submit button when no matches found
body: <p>I'm using Select2 to query a database and return the values. When the user types in a value that is not in the list, the no matches found message is shown. When that happens I also want to disable the submit button so the form can't be submitted .</p>
  
  <pre><code>&lt;form&gt;
      &lt;input id="select2" type="hidden" name="optionvalue" /&gt;
      &lt;input type="submit" value="Search" /&gt;
  &lt;/form&gt;
  
  &lt;script&gt;
      $(document).ready(function(){
         $('#select2').select2({
          ajax: {
            url: "selections.php",
            dataType: 'json',
            data: function (term, page) {
              return {
                q: term
              };
            },
            results: function (data, page) {
              return { results: data };
            }
          }
        });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Any help is much appreciated.</p>