The following script was found on StackOverflow. It is suppose to simulate a button click with the up-tick of an Enter key.
$("#id_of_textbox").keyup(function(event) {
if (event.keyCode === 13) {
$("#id_of_button").click();
}
});
Now, I am not using it for a textbox, but for a search box. In order to get it to work I have tried the following:
Used the <form> element as the selector for the keyup() function.
Used the <input> element of the search box as the selector for the keyup() function
Entered the code in various places within my script including the html and the called javascript documents that make the search engine work.
To no avail.
Now, it is true that I have not been entirely methodological in my selection of HTML elements and code placement. Still, ss many times as I have tried, however, you would think that Lady Luck would be on my side.
Any hints?
Please advise.
Roddy