Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Cycle through a list to see if there is a match for the characters entered into an input box

const menu_items = document.querySelectorAll('li');

function getInputValue() {
    // Selecting the input element and get its value 
    var inputVal = document.getElementById("myInput").value;
    menu_items.forEach(item => {
        if (item.textContent.includes(inputVal)) {
            console.log(inputVal + " is in the list.")
        }
    })
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: Literal string with a variable inserted 
Javascript :: escaping less than great than signs in react 
Javascript :: bootstrapMaterialDatePicker min date depends on other field value 
Javascript :: react movies 
Javascript :: how to revert parse date in javascript 
Javascript :: generate diffrent random array Numbers 
Javascript :: new Intl.NumberFormat en react 
Javascript :: Search products from an array by keywords in javascript 
Javascript :: angular number pipe to four decimals 
Javascript :: nodejs read file sent in the request without saving to file system 
Javascript :: undefined ext in fn.dataTable.ext.search.push 
Javascript :: javascript unique id 
Javascript :: javascript get each element count / occurrences / frequency from a list 
Javascript :: like and dislike function 
Javascript :: focus on child components on single page applications - 2 
Javascript :: how to show conditional show on select field 
Javascript :: assignment of struct in solidity 
Javascript :: Adding Handlers to All Forms 
Javascript :: jquery confirm dialog yes no 
Javascript :: how to empty nodeList 
Javascript :: Mandatory Parameter Shorthand javascript 
Javascript :: how to get random value from array in javascript 
Javascript :: javascript query corrector 
Javascript :: id on delete action javascript react 
Javascript :: how to get author in wordpress api react 
Javascript :: rnpm react-images-uploading 
Javascript :: unable to append div multiple times 
Javascript :: Private slots are new and can be created via Instance private fields 
Javascript :: leaftjs 
Javascript :: threejs check if camera is pointing towards object 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =