I’m trying to get a web page detect user keypresses within a particular form (there is a function to be called on each keypress). However my code is not working (console never prints to the log):
$(document).on("keypress","filterinput",function(e) {
console.log("press detected");
});
<form class="filterform"><input class="filterinput" type="text"></form>
You forgot the
.in the class selector: