title: Apply custom validation in select2
body: <p>I am using select2 which is working fine now.
  I want to validate it that its value can not be blank. I don't want to use jQuery validator plugin because there is other fields on form as well code for validation for form's other field is pre-written i am just applying select2 to every drop down.
  I have tried for solution on net but every answer is using jquery validator plugin.</p>
  
  <p>My code is</p>
  
  <pre><code>$('.select2-use').select2({
          placeholder: "Select",
          allowClear: true
      });
  
  &lt;select id="type" name="type" class="form-control select2-use"&gt;
      &lt;option value=""&gt;select type&lt;/option&gt;
      &lt;option value="U"&gt;User&lt;/option&gt;
      &lt;option value="A"&gt;Admin&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>My current validation is </p>
  
  <pre><code>if (type == '') {
     $("#type").closest("span[class='select2-selection--single']").css('border-color','#a94442'); //which is not working
     console.log($("#type").find('span.select2-selection--single'));
     flag++;
  } else {
    $('.select2-selection--single').css('border-color','');
  }
  </code></pre>
  
  <p>How can i change the border color of select2 span in red as error.</p>