I saw .focus(1)
in the jQuery UI code base and I could not figure out what the parameter is for.
How is it different from .focus()
?
I read .focus
documentation on the jQuery website but am still clueless.
Thanks.
jQuery focus() Method The focus event occurs when an element gets focus (when selected by a mouse click or by "tab-navigating" to it). The focus() method triggers the focus event, or attaches a function to run when a focus event occurs. Tip: This method is often used together with the blur() method.
JavaScript | Focus() It sets the element as the active element in the current document. It can be applied to one html element at a single time in a current document. The element can either be a button or a text field or a window etc. It is supported by all the browsers.
The focus() is an inbuilt method in jQuery which is used to focus on an element. The element get focused by the mouse click or by the tab-navigating button. Here selector is the selected element. Parameter: It accepts an optional parameter “function” which specifies the function to run when the focus event occurs.
.focus(1)
it just means that you want 1 millisecond delay.
http://api.jqueryui.com/focus/
API: jqueryui
.focus( delay [, callback ] )
This plugin extends jQuery's built-in .focus() method. If jQuery UI is not loaded, calling the .focus() method may not fail directly, as the method still exists. However, the expected behavior will not occur.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With