简体   繁体   中英

Keyup event not triggering

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:

https://jsfiddle.net/5mfz6o03/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM