I am trying to set the value of a search box using JavaScript in Chrome’s console, as shown in this screenshot:
I use the following code to set the value:
document.querySelector("body > main > eup-orders > div > div > div > div.table-header.form-inline.clearfix.with-search > form > div > div > input").value = "Hello World";
Next, I want to trigger the search by clicking the search button, as shown in this screenshot:
Here’s the code I use to click the button:
document.querySelector("#btn-search").click();
The problem: Although the value is successfully set in the search field, the search does not start unless I manually click inside the search field.
Question: Is there a way to programmatically trigger the update of the search field so it works without manual interaction?
Alternatively, is it possible to simulate pressing the Enter key?