Example 1 — Bind with .keyup(handler)
Legacy bind — runs when a key is released while the input has focus.
$("#target").keyup(function () {
console.log("Handler for keyup called.");
}); How It Works
- Select the input.
$("#target")must be focusable. - Call the shorthand.
.keyup(fn)registers the handler (internally uses.on). - Release a key. After press-and-release, the handler runs once.

