document.getElementById("SearchBox").addEventListener("keyup", handleSearchChange); function handleSearchChange(e) { console.log(e.target.value); // Check if known prefix is used (either > or #) if (e.target.value[0] == ">") { // Search for commands } else if (e.target.value[0] == "#") { // Search for SKU } else { // Search for name } }