title: Selecting a dropdown option from a for loop
body: <p>I have following for loop. Which sees if the data value is in the dropdown if so it will show it as selected.</p>
  
  <pre><code>for (var i in data) {
      $("#optionDropdwon option:contains(data[i])").prop("selected", true);
      console.log(data[i])
  }
  </code></pre>
  
  <p>It works fine when I replace <code>data[i]</code> in the <code>:contains()</code> with an actual string i.e "xyz"
  but when I replace it with <code>data[i]</code> nothing happens. Yet I can see <code>console.log(data[i])</code> shows me the proper values. 
  I searched Stackoverflow but couldn't find something like what I am doing. </p>
  
  <p>Please let me know where I am making a mistake. Thanks </p>