title: how to set selectedindex of select2 dropdown in javascript
body: <p>I have an asp.net dropdown for which I added select2 and a clear button in my page. When I click on clear button I would like to be able to set to the option at zero index. Below is the code:</p>
  
  <p>If I remove the select2 part, I'm able to clear the dropdown with "<code>ddlPatient.selectedIndex = 0;</code>"</p>
  
  <pre><code>$(document).ready(function() { debugger;   $("[id$=ddlPatients]").select2(); });
  
  function btnClear_Click() {
      debugger;
      var ddlPatient = document.getElementById("&lt;%=ddlPatients.ClientID %&gt;");
  
      ddlPatient.selectedIndex = 0;
  }
  
  &lt;asp:DropDownList ID="ddlPatients" runat="server"&gt;&lt;/asp:DropDownList&gt;
  &lt;asp:Button ID="btnClear" runat="server" CssClass="btn btn-info" Text="Clear" OnClientClick="btnClear_Click();return false;" /&gt;
  </code></pre>