How does js determine whether an element gets the focus? js determines the element focus.
How does js determine whether an element gets the focus:
There may be few requirements in practical applications, or the following method may be used to determine whether the element is too straightforward, but the principle is always the case. The following is an example of a simple method to determine whether the element gets the focus. The Code is as follows:
$ ("# Theid "). click (function () {var act = document. activeElement. id; if (act = "theid") {alert ("getting focus");} else {alert ("no getting focus ");}});
The code above meets our requirements to determine whether the specified Element gets the focus.
For more information about activeElement, see simple introduction to activeElement in js.
The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 11550.
For more information, see: http://www.softwhy.com/jquery/