Change your code to

$(function(){ // this will be called when the DOM is ready
  $('#searchInput').keyup(function() {
    alert('Handler for .keyup() called.');
  });
});

to ensure the DOM element exists when you build the jQuery set.

Answer from Denys Séguret on Stack Overflow
🌐
jQuery
api.jquery.com › keyup
keyup event | jQuery API Documentation
Bind an event handler to the "keyup" event, or trigger that event on an element.
🌐
W3Schools
w3schools.com › jquery › event_keyup.asp
jQuery keyup() Method
jQuery Overview jQuery Selectors jQuery Events jQuery Effects jQuery HTML/CSS jQuery Traversing jQuery AJAX jQuery Misc jQuery Properties ... The keyup event occurs when a keyboard key is released.
🌐
GitHub
github.com › jquery › jquery › issues › 1758
textbox not responding to keyup event in IE11 · Issue #1758 · jquery/jquery
October 21, 2014 - Originally reported by sylvain courcoux at: http://bugs.jquery.com/ticket/14595 Hi, I have a select element and a textbox element. The textbox is wired with a keyup event handler that checks if the input is numeric using a Regex and clea...
Author   mgol
Find elsewhere
🌐
Ask Ubuntu
askubuntu.com › questions › 1180091 › keyup-event-not-work-in-chrome
19.04 - Keyup Event Not Work in Chrome - Ask Ubuntu
October 10, 2019 - The keyup events for key A-Z do not work in <input type="text"> in the latest version of Google Chrome (Version 79.0.3945.88 (Official Build) (64-bit)). Only keys like ESC, Enter, Delete ... etc work. Does anyone have the same problem? Works: https://developer.mozilla.org/en-US/docs/Web/API/Document/keyup_event · Doesn't work: https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_event_keydown_keyup ·
🌐
W3Schools
w3schools.com › jsref › event_onkeyup.asp
onkeyup Event
It is not fired for all keys (like ALT, CTRL, SHIFT, ESC) in all browsers. To detect if the user presses a key, always use the onkeydown event. It works for all keys.
🌐
GeeksforGeeks
geeksforgeeks.org › jquery-keyup-with-examples
jQuery keyup() Method - GeeksforGeeks
November 18, 2022 - So, Using keyup() method we can detect if any key is released from the keyboard. ... Here selector is the selected element. Parameters: It accepts an optional parameter as a function which gives the idea whether any key is pressed or not. jQuery examples to show the working of keyup() Method: ...
🌐
CopyProgramming
copyprogramming.com › howto › jquery-keyup-function-not-working
JQuery Keyup Not Working: Complete Troubleshooting Guide with 2026 Best Practices - Javascript jquery not working with same javascript keyup
December 6, 2025 - With autofill, input fires but keyup might not. The input event is preferred for capturing all value changes. jQuery keyup events stop working primarily because event handlers only attach to existing elements and don't automatically include dynamically added content.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Element › keyup_event
Element: keyup event - Web APIs | MDN
September 25, 2025 - eventTarget.addEventListener("keyup", (event) => { if (event.isComposing) { return; } // do something }); Note: Unlike keydown, keyup events do not have special keyCode values for IME events.
🌐
jQuery
api.jquery.com › keypress
keypress event | jQuery API Documentation
Because of this distinction, when catching special keystrokes such as arrow keys, .keydown() or .keyup() is a better choice. Show the event object when a key is pressed in the input. Note: This demo relies on a simple $.print() plugin (https://api.jquery.com/resources/events.js) for the event object's output.