As known, IE has problems hiding options in dropdown menu.So I've written the following code to overpass the issue. The code runs fine when filtering, but
deleting characters, don't show all the options. The code is:
function filterDP(element) {
var value = $(element).val();
var dropdown = "#dropdown1";
$( dropdown+" > option").each(function() {
var optionValue = $(this).val();
if (navigator.appName == 'Microsoft Internet Explorer') {
$(dropdown).find('option[value="' + optionValue + '"]').map(function () {return $(this).parent('span').length === 0 ? this : null;})
.wrap('<span>').hide();
} //'Microsoft Internet Explorer'
if ((value == "") || ($(this).text().search(value) > -1) ){ // Found=>show();
if (navigator.appName == 'Microsoft Internet Explorer') {
$(dropdown).find('option[value="'+optionValue+'"]').unwrap().show();
}
else {
$(this).show(); //all other browsers use standard .show();
}
}
else { // not found=> Hide
if (navigator.appName == 'Microsoft Internet Explorer') {
$(dropdown).find('option[value="'+optionValue+'"]').hide();
}
else {
$(this).hide(); //all other browsers use standard .show();
}
}
});
}
$(document).ready(function(){
var dropDown1 = $("#dropdown1");
var td = dropDown1.closest("td");
td.prepend($('<input/>', {id: 'DPFilter',
onkeyup: 'filterDP(this)'
}));