Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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

        }
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: conditional onclick react 
Javascript :: how to loop through a map in js 
Javascript :: js two value from array after reduce 
Javascript :: javascript float precision 2 
Javascript :: string methods javascript 
Javascript :: how to do an isogram in javascript 
Javascript :: regex not js 
Javascript :: javascript time difference 
Javascript :: javascript remove required attribute 
Javascript :: javascript encryption decryption 
Javascript :: multiple image upload in react js 
Javascript :: if statement in react native 
Javascript :: javascript data 
Javascript :: react native flex 2 columns per row 
Javascript :: xmlhttprequest object 
Javascript :: new Map() collection in react state 
Javascript :: javascript appendchild before 
Javascript :: $.ajax how to read data vale in controller in rails 
Javascript :: javascript first letter uppercase 
Javascript :: typeof in js 
Javascript :: array.push 
Javascript :: js environment variables 
Javascript :: p5.js how to display a text from string 
Javascript :: math captcha 
Javascript :: how can hide link from inspect element 
Javascript :: append javascript example 
Javascript :: js map array to object 
Javascript :: why does javascript have hoisting 
Javascript :: what is asynchronous in javascript 
Javascript :: mariadb JSON_ARRAYAGG does not exist 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =