Your HTML is malformed (your
GetKey function call is using double quotes inside double quotes). That is causing issues potentially but since you're using Razor I haven't tested it. Your initial function is trying to hook up the event before the element is even defined so that would fail as well. The browser's console window should be showing you errors for these.
Here's the simplest equivalent code to do what you want.
The HTML you're using isn't the HTML I gave you. Your results won't be like mine. The script blocks, for example, need to be in the
headof the HTML, not the
The rest of your HTML seems like you are inserting into existing code. The HTML I gave you works without errors and doesn't do what you're seeing. The problem is in your HTML file you dropped it into.
Notice, for example that you're using JQuery inside your event handler to find the search box. But the event already has that. Refer to my code where I use the event to get the target element. Remove your existing keyup script logic and replace it with mine. See if your problems go away.
If they don't then post the entirety of the HTML file you're trying to run but you can leave out things in the body outside the