Answers for "select option filter javascript"

0

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();
            }

        }
    }
Posted by: Guest on January-18-2021

Code answers related to "select option filter javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language