title: How to update the chosen-select text using Jquery and PHP
body: <p>I need to change the <code>chosen-select</code> text of one select option using Jquery. I am providing my code below.</p>
  
  <pre><code>&lt;select name="countryCode" class="chosen-select" id="countryCode" required&gt;
    &lt;?php foreach ($countrydata as $key =&gt; $value) {
       if ($value['con_code']=='IN') {
            $select='selected';
        }else{
            $select='';
       }
   ?&gt;
    &lt;option data-text="&lt;?php echo $value['country']; ?&gt;" value="&lt;?php echo $value['dial_code']; ?&gt;" &lt;?php echo $select; ?&gt;&gt;&lt;?php echo $value['country']; ?&gt;&lt;/option&gt;
   &lt;?php } ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>The script part is given below.</p>
  
  <pre><code>$('.chosen-select').select2( { width:'100%', maximumSelectionSize: 1 } );
      $('#countryCode').html(
                         $('#countryCode').find(':selected').attr('value')
                       ).trigger('chosen:updated');
  </code></pre>
  
  <p>Here I need the selected value will be shown as its text.</p>