title: Jquery : Select option of dropdown based on textbox text
body: <p>I have tried to select option based on the textbox text.</p>
  
  <p>Below is my html</p>
  
  <pre><code>&lt;select id="select1"&gt;
      &lt;option value=""&gt;-- Please Select --&lt;/option&gt;
      &lt;option value="277"&gt;12 +$2.99&lt;/option&gt;
      &lt;option value="278"&gt;25 +$2.75&lt;/option&gt;
      &lt;option value="279"&gt;50 +$2.50&lt;/option&gt;
      &lt;option value="280"&gt;100 +$2.00&lt;/option&gt;
      &lt;option value="281"&gt;250 +$1.90&lt;/option&gt;
      &lt;option value="282"&gt;500 +$1.70&lt;/option&gt;
      &lt;option value="283"&gt;1000 +$1.60&lt;/option&gt;
      &lt;option value="284"&gt;2500 +$1.50&lt;/option&gt;
      &lt;option value="285"&gt;5000 +$1.20&lt;/option&gt;
      &lt;option value="286"&gt;10000 +$1.00&lt;/option&gt;
      &lt;option value="287"&gt;25000 +$0.80&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="text" id="pqr" /&gt;
  </code></pre>
  
  <p>And my js like bellow</p>
  
  <pre><code> $(function(){
      $('#pqr').change(function(){
          $txt = $( "#select1 option:contains('"+$(this).val()+"')" ).text();
              $arr = $txt.split(" +");
              $( "#select1").val($txt);
              alert($arr[0])
              $( "#select1" ).filter(function() {
                   alert($( this ).text &gt; $arr[0]);
              })
      });
  });
  </code></pre>
  
  <p>so if user enter text 12 or greater than 12 and bellow 25 than i want to select option second 12 +$2.99 and if user enter 1500 than option 1000 +$1.60 get selected. Basically i have try to compare option text before (+) sign and try to select based on that.</p>
  
  <p>Please give me hint or any good help so solve this problem</p>