I use jquery popup dialog, and in this dialog I have input and select box, i want to hide some options in select box, its worked in ff, but not worked in chrome .
<input type="text" onkeyup="search(this.value)" >
<select id="cl_sel_l" multiple="multiple">
<option value='2' id='c_2'>aa</option>
<option value='3' id='c_3'>bb</option>
<option value='4' id='c_4'>cc</option>
<option value='5' id='c_5'>dd</option>
</select>
var clients = new Array();
clients[2] ='aa';
clients[3] ='bb';
clients[4] ='cc';
clients[5] ='dd';
function search(val) {
for ( var i in clients) {
if (clients[i].toLowerCase().search(val.toLowerCase()) == -1) {
$("#cl_sel_l").find("#c_" + i).hide();
} else {
$("#cl_sel_l").find("#c_" + i).show();
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…