title: Yii2-How to hide a value from a dropdown list in javascript
body: <p>I have a dropdown list in which there are some static values. </p>
  
  <pre><code>    &lt;?= $form-&gt;field($model, 'source')-&gt;dropDownList([''=&gt;'Please Select','Farhan' =&gt; 'Farhan', 'Usman' =&gt; 'Usman','Waseem'=&gt;'Waseem','Habib'=&gt;'Habib', 'HESCO' =&gt; 'HESCO']) ?&gt;
  </code></pre>
  
  <p>Corresponding HTML is </p>
  
  <pre><code>&lt;select id="refnumbers-source" class="form-control" 
  name="RefNumbers[source]" aria-required="true"&gt;
  &lt;option value=""&gt;Please Select&lt;/option&gt;
  &lt;option value="Farhan"&gt;Farhan&lt;/option&gt;
  &lt;option value="Usman"&gt;Usman&lt;/option&gt;
  &lt;option value="Waseem"&gt;Waseem&lt;/option&gt;
  &lt;option value="Habib"&gt;Habib&lt;/option&gt;
  &lt;option value="HESCO"&gt;HESCO&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Now based on a user role in javascript I want to hide an option/value from the dropdown. I am able to get a user role but now I want to hide a value. </p>
  
  <pre><code>&lt;?php
  $script = &lt;&lt;&lt; JS
  
  
   $(document).ready(function () {  
  
       if($user_role.val() === 1)
  
        //here I want to hide the value 'HESCO' from dropdownlist
       }); 
  JS;
  $this-&gt;registerJs($script);
  ?&gt;
  </code></pre>
  
  <p>How can I achieve this?</p>
  
  <p>Any help would be highly appreciated</p>