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.
.on()
In most cases, an event such as ... is not a significant concern. However, high frequency events such as mousemove or scroll can fire dozens of times per second, and in those cases it becomes more important to use events judiciously. Performance can be increased by reducing the amount of work done in the ...
.each()
Description: Iterate over a jQuery object, executing a function for each matched element · The .each() method is designed to make DOM looping constructs concise and less error-prone. When called it iterates over the DOM elements that are part of the jQuery object.
Click event
Description: Bind an event handler to the "click" event · This page describes the click event. For the deprecated .click() method, see .click()
.append()
Description: Insert content, specified by the parameter, to the end of each element in the set of matched elements · The .append() method inserts the specified content as the last child of each element in the jQuery collection (To insert it as the first child, use .prepend())
🌐
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 ·
🌐
GeeksforGeeks
geeksforgeeks.org › jquery › jquery-keyup-method
jQuery keyup() Method - GeeksforGeeks
July 11, 2025 - 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: ...
🌐
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.
🌐
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.
🌐
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.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Element › keyup_event
Element: keyup event - Web APIs | MDN
eventTarget.addEventListener("keyup", (event) => { if (event.isComposing) { return; } // do something }); Note: Unlike keydown, keyup events do not have special keyCode values for IME events.