For example, this navigation website: https://www.2345.com/
After opening, the cursor did not automatically locate the Baidu search box.
I tried to get the id and call the focus function but it didn’t work.
How to write a piece of js code to automatically get focus every time you open this website?
The effect is like https://www.hao123.com/
focus()
should be fine, just write something like:Can you post the code for a look?
Write the autofocus attribute directly on the input tag. Is it the onfocus() method in js?