我的浏览器有问题,我在 jsfiddle 中有代码,它通过提供输入来显示匹配结果。但它在 FF 中运行良好而不是在 IE 中
jsfiddle 中的 jquery 版本是 jquery 1.9.1 IE ver。9、FF 24.0版
$("#searchInput").keyup(function () {
//split the current value of searchInput
var data = this.value.toLowerCase().split(" ");
//create a jquery object of the rows
var jo = $("#selectbox").find("option");
if (this.value == "") {
jo.show();
return;
}
//hide all the rows
jo.hide();
//Recusively filter the jquery object to get results.
jo.filter(function (i, v) {
var $t = $(this);
for (var d = 0; d < data.length; ++d) {
if ($t.is(":contains('" + data[d] + "')")) {
return true;
}
}
return false;
})
//show the rows that match.
.show();
});