filter Selection() javascript code example
Example: select option filter javascript
function filter() {
var keyword = document.getElementById("search").value;
var select = document.getElementById("select");
for (var i = 0; i < select.length; i++) {
var txt = select.options[i].text;
if (!txt.match(keyword)) {
$(select.options[i]).attr('disabled', 'disabled').hide();
} else {
$(select.options[i]).removeAttr('disabled').show();
}
}
}