I have an input(id=quickS) and a select(id=lbSLI\_L) element like below.

[![enter image description here](https://i.stack.imgur.com/I4x9h.jpg)](https://i.stack.imgur.com/I4x9h.jpg)

My Jquery code like :

```
$(document).ready(function () {

    $("#quickS").keyup(function () {

        $("#lbSLI_L option:selected").attr('selected', false);

        $("#lbSLI_L option:contains(" + $("#quickS").val() + ")").eq(0).attr('selected', 'selected');

    });

});

```

Option text containing 1 will be selected when I type 1 in input element. 

[![enter image description here](https://i.stack.imgur.com/fdY9M.jpg)](https://i.stack.imgur.com/fdY9M.jpg)

But when I delete 1 and type it again in input element, the same option won't be selected like first time.

[![enter image description here](https://i.stack.imgur.com/VOdcb.jpg)](https://i.stack.imgur.com/VOdcb.jpg)

Did I make any mistake in my code? 

```js
$(document).ready(function () {

    $("#quickS").keyup(function () {

        $("#lbSLI_L option:selected").removeAttr('selected');

        $("#lbSLI_L option:contains(" + $(this).val() + ")").eq(0).attr('selected', 'selected');

    });

});
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<input name="quickS" type="text" id="quickS" style="width:163px;" />
                <select size="6" name="lbSLI_L" multiple="multiple" id="lbSLI_L" style="height:90px;width:172px;">
  <option value="O/L線路斷路">1. O/L線路斷路</option>
  <option value="壓合凹陷皺褶">10. 壓合凹陷皺褶</option>
  <option value="前製程基材破裂">100. 前製程基材破裂</option>
  <option value="基材破裂(8E)">101. 基材破裂(8E)</option>
  <option value="前製程線路變細">102. 前製程線路變細</option>
  <option value="鑽孔不對位">11. 鑽孔不對位</option>
  <option value="漏鑽孔、孔未貫穿">12. 漏鑽孔、孔未貫穿</option>
  <option value="多鑽孔">13. 多鑽孔</option>
  <option value="斷鑽報廢">14. 斷鑽報廢</option>
  <option value="O/L線路缺口">17. O/L線路缺口</option>
  <option value="O/L對位不良">18. O/L對位不良</option>
  <option value="O/L外層短路">2. O/L外層短路</option>
  <option value="O/L銅殘留">20. O/L銅殘留</option>
  <option value="Pad破損">22. Pad破損</option>
  <option value="線路刮撞傷">23. 線路刮撞傷</option>
  <option value="修補O/L蝕刻不全">25. 修補O/L蝕刻不全</option>
  <option value="修補線路刮撞傷">29. 修補線路刮撞傷</option>
  <option value="基材破裂">3. 基材破裂</option>
  <option value="修補顯影刮撞傷">30. 修補顯影刮撞傷</option>
  <option value="顯影刮撞傷">32. 顯影刮撞傷</option>
  <option value="O/L線路斷路(共同性)">33. O/L線路斷路(共同性)</option>
  <option value="O/L外層短路(共同性)">34. O/L外層短路(共同性)</option>
  <option value="O/L線路缺口(共同性)">35. O/L線路缺口(共同性)</option>
  <option value="O/L銅殘留(共同性)">36. O/L銅殘留(共同性)</option>
  <option value="孔內結瘤">37. 孔內結瘤</option>
  <option value="顯影刮撞傷(集中區域)">38. 顯影刮撞傷(集中區域)</option>
  <option value="修補O/L外層短路(共同性)">39. 修補O/L外層短路(共同性)</option>
  <option value="AOS">4. AOS</option>
  <option value="修補O/L銅殘留(共同性)">40. 修補O/L銅殘留(共同性)</option>
  <option value="修補夾膜殘銅">41. 修補夾膜殘銅</option>
  <option value="修補顯影刮撞傷(集中區域)">42. 修補顯影刮撞傷(集中區域)</option>
  <option value="修補滲鍍">43. 修補滲鍍</option>
  <option value="修補O/L外層短路">44. 修補O/L外層短路</option>
  <option value="修補O/L銅殘留">45. 修補O/L銅殘留</option>
  <option value="O/L線路變細">46. O/L線路變細</option>
  <option value="結瘤(SHORT)">47. 結瘤(SHORT)</option>
  <option value="乾膜浮(剝)離">48. 乾膜浮(剝)離</option>
  <option value="線路分層">49. 線路分層</option>
  <option value="凹陷">5. 凹陷</option>
  <option value="內層紅筆報廢">50. 內層紅筆報廢</option>
  <option value="PTH壓傷">51. PTH壓傷</option>
  <option value="異物抗鍍">52. 異物抗鍍</option>
  <option value="外層前刮傷">53. 外層前刮傷</option>
  <option value="填孔不良">55. 填孔不良</option>
  <option value="乾膜殘留">56. 乾膜殘留</option>
  <option value="棕化不良">57. 棕化不良</option>
  <option value="壓合氣泡">58. 壓合氣泡</option>
  <option value="異物抗咬蝕">59. 異物抗咬蝕</option>
  <option value="夾膜殘銅">6. 夾膜殘銅</option>
  <option value="底銅抗咬蝕">60. 底銅抗咬蝕</option>
  <option value="藥液殘留(72)">62. 藥液殘留(72)</option>
  <option value="內層紅筆劃超出">63. 內層紅筆劃超出</option>
  <option value="孔銅斜角">64. 孔銅斜角</option>
  <option value="等高殘銅">66. 等高殘銅</option>
  <option value="光點不見/破損">67. 光點不見/破損</option>
  <option value="樹脂灌孔不良">68. 樹脂灌孔不良</option>
  <option value="修補異物抗咬蝕">69. 修補異物抗咬蝕</option>
  <option value="滲鍍">7. 滲鍍</option>
  <option value="修補底銅抗咬蝕">70. 修補底銅抗咬蝕</option>
  <option value="修補等高殘銅">71. 修補等高殘銅</option>
  <option value="板面氧化污染(68)">72. 板面氧化污染(68)</option>
  <option value="修補結瘤(SHORT)">73. 修補結瘤(SHORT)</option>
  <option value="破孔(29)">74. 破孔(29)</option>
  <option value="黑色異物">75. 黑色異物</option>
  <option value="玻纖異常">76. 玻纖異常</option>
  <option value="板面殘膠污染(68)">77. 板面殘膠污染(68)</option>
  <option value="線路錯位(4D)">78. 線路錯位(4D)</option>
  <option value="線路刮撞傷-剝離(89)">79. 線路刮撞傷-剝離(89)</option>
  <option value="O/L蝕刻不全">8. O/L蝕刻不全</option>
  <option value="其他.">80. 其他.</option>
  <option value="其他.">81. 其他.</option>
  <option value="其他">82. 其他</option>
  <option value="孔位偏移">9. 孔位偏移</option>
  <option value="前製程基材破裂">98. 前製程基材破裂</option>
  <option value="切片">99. 切片</option>
  <option value="未定義劃記報廢">UN. 未定義劃記報廢</option>

 </select>
```