title: Jquery select not working
body: <p>I have a div -</p>
  
  <pre><code>&lt;div id="billTypeDropDown" class="form-group dropdown"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I am using jquery to set a select element inside this div</p>
  
  <pre><code>$('#billTypeDropDown').html(getDropDown('billtype'));
  </code></pre>
  
  <p>After this my select looks like this -
  <a href="https://i.stack.imgur.com/z2Dsw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z2Dsw.png" alt="enter image description here"></a></p>
  
  <p>Now, In my another jquery flow, I am using this code -</p>
  
  <pre><code>$('#billTypeDropDown select option[value="Select One"]').prop('selected', true); //this is called after preparing the page
  $('#billTypeDropDown').find('select').find('option').filter(function(){
                  return $(this).prop('id') == $candidate.emp_type_c;
              }).prop('selected', true); //this is called when I have data on the page
  </code></pre>
  
  <p>But this simple second statement which is supposed to set the value from $candidate.emp_type_c is not setting the selected value in my dropdown select.</p>
  
  <p>I tried all these, but none of these work -</p>
  
  <pre><code>$('#billTypeDropDown select option[id='+$candidate.emp_type_c+']').attr('selected', 'selected');
  
  $('#billTypeDropDown').find('select').find('option').each(function(){
                  if($(this).prop('id') == $candidate.emp_type_c){
                      $(this).prop('selected', true);
                  }
              });
  
  $('#billTypeDropDown').find('select').find('option').filter(function(){
                  return $(this).prop('id') == $candidate.emp_type_c;
              }).prop('selected', true);
  </code></pre>
  
  <p>Can you please point out the error?</p>
  
  <p>PS -I have another dropdown, and this code work fine for that -</p>
  
  <pre><code>$('#visaDropDown select option').filter(function(){
              return $(this).prop('id') == $candidate.visa_type_c;
          }).prop('selected', true);
  </code></pre>