The problem that the focus of js's focus () is not triggered.

problem description

jsinputfocus()textarea

the environmental background of the problems and what methods you have tried

I encountered the problem that focus () does not trigger while debugging the front-end code. In the example in the figure below, I tried to get the focus of the codeshelper search box, but it didn"t work.

related codes

document.getElementById("searchBox").focus()

what result do you expect? What is the error message actually seen?

do you want to know that focus () cannot take effect until the DOM is loaded? How to get the focus of the text box simply and efficiently.

Nov.14,2021

el.onfocus = function () {dosomething. }

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46aba-43f29.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46aba-43f29.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?