It is the HTML Code.I put input for entering key and for pressing.
<input type="text" id="filterInput" placeholder="Search names...">
What is wrong with this code?
let filterInput;//(optional)
let filterInput = document.getElementById('filterInput');
filterInput.addEventListener('Keyup', filterNames);
function filterNames() {
console.log(1);
}
"Keyup" should be "keyup"
filterInput.addEventListener('keyup', filterNames);
Working fiddle:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.