You'd want to do a little rewriting. All of the stuff that locates the first search field could be scrapped and replaced with a simple document.querySelector('#filterByKeywordTextBox'). Then you can just call .focus() on that element, and probably scroll the page as needed.
Comments
Brett, this is great! Thanks for sharing, this is still working well 8 years later.
Can I ask how this would be modified to move focus to the "Search customer reviews" text box on an Amazon product page like here: https://www.amazon.com/product-reviews/B08MF8SBMS
Thank you in advance!
You'd want to do a little rewriting. All of the stuff that locates the first search field could be scrapped and replaced with a simple
document.querySelector('#filterByKeywordTextBox'). Then you can just call.focus()on that element, and probably scroll the page as needed.That works great, thanks for the reply! Love your work!