Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does jQuery .focus(1) do? How is it different from .focus()?

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.

like image 888
user2291835 Avatar asked May 16 '13 21:05

user2291835


People also ask

What is focus function in jQuery?

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.

What does focus() do in JavaScript?

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.

Is focus in jQuery?

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.


1 Answers

.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.

like image 65
Mohammad Adil Avatar answered Oct 10 '22 15:10

Mohammad Adil