Professional Documents
Culture Documents
org/)
Support(https://jquery.org/support/) jQueryFoundation(https://jquery.org/)
IjoiYnJvYWRjYXN0IiwidXIiOiJodHRwczovL2pxdWVyeS5vcmcvZG9uYXRlLyJ9&s=hRDA6RCD7fgkMlidT4GP8saXcFo)
Download(http://jquer.com/download/) Search
APIDocumentation(http://api.jquer.com/)
log(http://log.jquer.com/)
Plugin(http://plugin.jquer.com/)
rowerupport(http://jquer.com/rowerupport/)
Ajax
(//api.jquery.com/category/ajax/)
.focu()
GlobalAjaxEvent
Categories:Events(//api.jquery.com/category/events/)>FormEvents
Handlers
(//api.jquery.com/category/events/formevents/)|Forms(//api.jquery.com/category/forms/)
(//api.jquery.com/category/ajax/global
ajaxevent
handlers/) .focu(handler)
Return:jQuer(http://api.jquer.com/Tpe/#jQuer)
HelperFunctions
(//api.jquery.com/category/ajax/helper
Description:Bindaneventhandlertothe"focus"JavaScript
functions/)
event,ortriggerthateventonanelement.
LowLevel
Interface .focu(handler) verionadded:1.0(/categor/verion/1.0/)
(//api.jquery.com/category/ajax/low
levelinterface/) handler
Type:Function(http://api.jquery.com/Types/#Function)(Event
ShorthandMethods (http://api.jquery.com/Types/#Event)eventObject)
(//api.jquery.com/category/ajax/shorthand
Afunctiontoexecuteeachtimetheeventistriggered.
methods/)
.focu([eventData], verionadded:1.4.3(/categor/verion/1.4.3/)
handler)
Attributes
(//api.jquery.com/category/attributes/)
eventData
CallbacksObject Type:Anything(http://api.jquery.com/Types/#Anything)
Anobjectcontainingdatathatwillbepassedtotheeventhandler.
(//api.jquery.com/category/callbacks
object/)
handler
Core Type:Function(http://api.jquery.com/Types/#Function)(Event
(//api.jquery.com/category/core/) (http://api.jquery.com/Types/#Event)eventObject)
Afunctiontoexecuteeachtimetheeventistriggered.
CSS
(//api.jquery.com/category/css/) .focu() verionadded:1.0(/categor/verion/1.0/)
Data
Thissignaturedoesnotacceptanyarguments.
(//api.jquery.com/category/data/)
DeferredObject
Thismethodisashortcutfor .on("focu",handler) inthefirst
(//api.jquery.com/category/deferred andsecondvariations,and .trigger("focu") inthethird.
object/)
The focu eventissenttoanelementwhenitgainsfocus.This
Deprecated eventisimplicitlyapplicabletoalimitedsetofelements,suchas
formelements( <input> , <elect> ,etc.)andlinks( <ahref> ).In
(//api.jquery.com/category/deprecated/)
Deprecated1.3 recentbrowserversions,theeventcanbeextendedtoincludeall
elementtypesbyexplicitlysettingtheelement's taindex property.
(//api.jquery.com/category/deprecated/deprecated
Anelementcangainfocusviakeyboardcommands,suchastheTab
1.3/)
key,orbymouseclicksontheelement.
Deprecated1.7 Elementswithfocusareusuallyhighlightedinsomewaybythe
(//api.jquery.com/category/deprecated/deprecated
browser,forexamplewithadottedlinesurroundingtheelement.The
1.7/) focusisusedtodeterminewhichelementisthefirsttoreceive
keyboardrelatedevents.
Deprecated1.8
(//api.jquery.com/category/deprecated/deprecated
1.8/) Attemptingtosetfocustoahiddenelementcausesanerrorin
InternetExplorer.Takecaretoonlyuse .focu() onelements
Deprecated1.9
thatarevisible.Torunanelement'sfocuseventhandlerswithout
(//api.jquery.com/category/deprecated/deprecated
settingfocustotheelement,use .triggerHandler("focu")
1.9/)
insteadof .focu() .
Deprecated1.10
(//api.jquery.com/category/deprecated/deprecated
1.10/) Forexample,considertheHTML:
Deprecated3.0
1 <form>
(//api.jquery.com/category/deprecated/deprecated
2 <inputid="target"tpe="text"value="Field1">
3.0/) 3 <inputtpe="text"value="Field2">
4 </form>
5 <divid="other">
Dimensions 6 Triggerthehandler
7 </div>
(//api.jquery.com/category/dimensions/)
Effects
(//api.jquery.com/category/effects/)
Theeventhandlercanbeboundtothefirstinputfield:
Basics
(//api.jquery.com/category/effects/basics/)
1 $("#target").focu(function(){
2 alert("Handlerfor.focu()called.");
3 });
Custom
Nowclickingonthefirstfield,ortabbingtoitfromanotherfield,displaysthe
(//api.jquery.com/category/effects/custom
effects/) alert:
Fading Handlerfor.focus()called.
(//api.jquery.com/category/effects/fading/)
Wecantriggertheeventwhenanotherelementisclicked:
Sliding
(//api.jquery.com/category/effects/sliding/)
1 $("#other").click(function(){
2 $("#target").focu();
3 });
Events
(//api.jquery.com/category/events/)
BrowserEvents Afterthiscodeexecutes,clicksonTriggerthehandlerwillalsoalert
themessage.
(//api.jquery.com/category/events/browser
events/)
The focu eventdoesnotbubbleinInternetExplorer.Therefore,scripts
DocumentLoading thatrelyoneventdelegationwiththe focu eventwillnotwork
consistentlyacrossbrowsers.Asofversion1.4.2,however,jQueryworks
(//api.jquery.com/category/events/document
loading/) aroundthislimitationbymapping focu tothe focuin eventinitsevent
delegationmethods, .live() (/live/)and .delegate() (/delegate/).
EventHandler
Attachment AdditionalNote:
(//api.jquery.com/category/events/event
handler Asthe .focu() methodisjustashorthandfor .on("focu",
attachment/) handler) ,detachingispossibleusing .off("focu") .
EventObject
xample:
(//api.jquery.com/category/events/event
object/) Firefocus.
FormEvents
1 <!doctpehtml>
(//api.jquery.com/category/events/form
2 <htmllang="en">
events/) 3 <head>
4 <metacharet="utf-8">
KeyboardEvents 5 <title>focudemo</title>
6 <tle>
(//api.jquery.com/category/events/keyboard
7 pan{
events/)
8 dipla:none;
9 }
MouseEvents
10 </tle>
11 <criptrc="http://code.jquer.com/jquer-1.10.2.j
(//api.jquery.com/category/events/mouse
events/) 12 </head>
13 <od>
14
15 <p><inputtpe="text"><pan>focufire</pan></p
Forms
16 <p><inputtpe="paword"><pan>focufire</pan
(//api.jquery.com/category/forms/) 17
18 <cript>
Internals 19 $("input").focu(function(){
20 $(thi).next("pan").c("dipla","inline"
(//api.jquery.com/category/internals/)
21 });
Manipulation 22 </cript>
23
(//api.jquery.com/category/manipulation/)
24 </od>
25 </html>
ClassAttribute
(//api.jquery.com/category/manipulation/class
attribute/) Demo:
Copying
(//api.jquery.com/category/manipulation/copying/)
DOMInsertion,
Around
(//api.jquery.com/category/manipulation/dom
insertionaround/)
DOMInsertion,
Inside
(//api.jquery.com/category/manipulation/dom
insertioninside/)
DOMInsertion, Tostoppeoplefromwritingintextinputboxes,try:
Outside
(//api.jquery.com/category/manipulation/dom
1 $("input[tpe=text]").focu(function(){
insertionoutside/) 2 $(thi).lur();
3 });
DOMRemoval
(//api.jquery.com/category/manipulation/dom
removal/) Tofocusonalogininputboxwithid'login'onpagestartup,try:
DOMReplacement
1 $(document).read(function(){
(//api.jquery.com/category/manipulation/dom
2 $("#login").focu();
replacement/) 3 });
GeneralAttributes
(//api.jquery.com/category/manipulation/general
attributes/)
StyleProperties
(//api.jquery.com/category/manipulation/style
properties/)
Miscellaneous
(//api.jquery.com/category/miscellaneous/)
Collection
Manipulation
(//api.jquery.com/category/miscellaneous/collection
manipulation/)
DataStorage
(//api.jquery.com/category/miscellaneous/data
storage/)
DOMElement
Methods
(//api.jquery.com/category/miscellaneous/dom
elementmethods/)
SetupMethods
(//api.jquery.com/category/miscellaneous/setup
methods/)
Offset
(//api.jquery.com/category/offset/)
Properties
(//api.jquery.com/category/properties/)
Propertiesof
jQueryObject
Instances
(//api.jquery.com/category/properties/jquery
objectinstance
properties/)
Propertiesofthe
GlobaljQuery
Object
(//api.jquery.com/category/properties/global
jqueryobject
properties/)
Removed
(//api.jquery.com/category/removed/)
Selectors
(//api.jquery.com/category/selectors/)
Attribute
(//api.jquery.com/category/selectors/attribute
selectors/)
Basic
(//api.jquery.com/category/selectors/basic
cssselectors/)
BasicFilter
(//api.jquery.com/category/selectors/basic
filterselectors/)
ChildFilter
(//api.jquery.com/category/selectors/child
filterselectors/)
ContentFilter
(//api.jquery.com/category/selectors/content
filterselector/)
Form
(//api.jquery.com/category/selectors/form
selectors/)
Hierarchy
(//api.jquery.com/category/selectors/hierarchy
selectors/)
jQueryExtensions
(//api.jquery.com/category/selectors/jquery
selector
extensions/)
VisibilityFilter
(//api.jquery.com/category/selectors/visibility
filterselectors/)
Traversing
(//api.jquery.com/category/traversing/)
Filtering
(//api.jquery.com/category/traversing/filtering/)
Miscellaneous
Traversing
(//api.jquery.com/category/traversing/miscellaneous
traversal/)
TreeTraversal
(//api.jquery.com/category/traversing/tree
traversal/)
Utilities
(//api.jquery.com/category/utilities/)
Version
(//api.jquery.com/category/version/)
Version1.0
(//api.jquery.com/category/version/1.0/)
Version1.0.4
(//api.jquery.com/category/version/1.0.4/)
Version1.1
(//api.jquery.com/category/version/1.1/)
Version1.1.2
(//api.jquery.com/category/version/1.1.2/)
Version1.1.3
(//api.jquery.com/category/version/1.1.3/)
Version1.1.4
(//api.jquery.com/category/version/1.1.4/)
Version1.2
(//api.jquery.com/category/version/1.2/)
Version1.2.3
(//api.jquery.com/category/version/1.2.3/)
Version1.2.6
(//api.jquery.com/category/version/1.2.6/)
Version1.3
(//api.jquery.com/category/version/1.3/)
Version1.4
(//api.jquery.com/category/version/1.4/)
Version1.4.1
(//api.jquery.com/category/version/1.4.1/)
Version1.4.2
(//api.jquery.com/category/version/1.4.2/)
Version1.4.3
(//api.jquery.com/category/version/1.4.3/)
Version1.4.4
(//api.jquery.com/category/version/1.4.4/)
Version1.5
(//api.jquery.com/category/version/1.5/)
Version1.5.1
(//api.jquery.com/category/version/1.5.1/)
Version1.6
(//api.jquery.com/category/version/1.6/)
Version1.7
(//api.jquery.com/category/version/1.7/)
Version1.8
(//api.jquery.com/category/version/1.8/)
Version1.9
(//api.jquery.com/category/version/1.9/)
Version1.12&2.2
(//api.jquery.com/category/version/1.12
2.2/)
Version3.0
(//api.jquery.com/category/version/3.0/)
Version3.1
(//api.jquery.com/category/version/3.1/)
OOK
Copyright2016ThejQueryFoundation
(https://jquery.org/team/).jQueryLicense
LearningCenter (http://learn.jquery.com/)
(https://jquery.org/license/)
Forum (http://forum.jquery.com/)
WebhostingbyMediaTemple(http://mediatemple.net)|
CDNbyMaxCDN(http://www.maxcdn.com)|
PoweredbyWordPress(http://wordpress.org/)|Thanks:
API (http://api.jquery.com/)
Members(https://jquery.org/members/),Sponsors
(https://jquery.org/sponsors/)
Twitter (https://twitter.com/jquery)
IRC (http://irc.jquery.org/)
GitHub (https://github.com/jquery)