From 1b00d2bbabfc0fa0d00e1582c34cc5e63bec12a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
This method is a shortcut for The For example, consider the HTML: Now if the first field has the focus, clicking elsewhere or tabbing away from it displays the alert:
- Handler for .blur() called.
- To trigger the event programmatically, apply After this code executes, clicks on Trigger the handler will also alert the message. The The For example, consider the HTML: Now if the first field has the focus, clicking elsewhere or tabbing away from it displays the alert:
+ Handler for `blur` called.
+ To trigger the event programmatically, call After this code executes, clicks on Trigger the handler will also alert the message. The See the description for This API is deprecated. Instead of Instead of After this code executes, clicks on Trigger the handler will also alert the message. The Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the To observe this method in action, set up a basic Ajax load request: Attach the event handler to any element: Now, make an Ajax request using any jQuery method: When the user clicks the element with class Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the To observe this method in action, set up a basic Ajax load request: Attach the event handler to any element: Now, make an Ajax request using any jQuery method: When the user clicks the element with class This API is deprecated. Use Note: You can get the returned Ajax contents by looking at After this code executes, clicks on Trigger the handler will also alert the message. The The Attempting to set focus to a hidden element causes an error in Internet Explorer. Take care to only use For example, consider the HTML: The event handler can be bound to the first input field: Now clicking on the first field, or tabbing to it from another field, displays the alert:
- Handler for .focus() called.
- We can trigger the event when another element is clicked: After this code executes, clicks on Trigger the handler will also alert the message. The Attempting to set focus to a hidden element causes an error in Internet Explorer. Take care to only use For example, consider the HTML: The event handler can be bound to the first input field: Now clicking on the first field, or tabbing to it from another field, displays the alert:
+ Handler for `focus` called.
+ We can trigger the event when another element is clicked: After this code executes, clicks on Trigger the handler will also alert the message. The See the description for This API is deprecated. Instead of Instead of This API is deprecated. Instead of Instead of This API is deprecated. Instead of Instead of This API is deprecated. Instead of Instead of This API is deprecated. Instead of Instead of The For example, consider the HTML: Now if the first field has the focus, clicking elsewhere or tabbing away from it displays the alert:
@@ -38,9 +38,9 @@
To trigger the event programmatically, call After this code executes, clicks on Trigger the handler will also alert the message. The For example, consider the HTML: The event handler can be bound to the first input field: Now clicking on the first field, or tabbing to it from another field, displays the alert:
@@ -47,9 +46,9 @@
We can trigger the event when another element is clicked: After this code executes, clicks on Trigger the handler will also alert the message. The This API is deprecated. Instead of Instead of This method is a shortcut for The This event will likely be used together with the focusout event. See the description for This API is deprecated. Instead of Instead of This method is a shortcut for The This event will likely be used together with the focusin event. See the description for .on( "blur", handler )
in the first two variations, and .trigger( "blur" )
in the third.blur
event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <input>
. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.
-
-<form>
- <input id="target" type="text" value="Field 1">
- <input type="text" value="Field 2">
-</form>
-<div id="other">
- Trigger the handler
-</div>
-The event handler can be bound to the first input field:
-$( "#target" ).blur(function() {
- alert( "Handler for .blur() called." );
-});
-
.blur()
without an argument:
-
-$( "#other" ).click(function() {
- $( "#target" ).blur();
-});
-
blur
event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the blur
event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping blur
to the focusout
event in its event delegation methods, .live()
and .delegate()
.
-
"blur"
.blur
event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <input>
. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.
+
+ <form>
+ <input id="target" type="text" value="Field 1">
+ <input type="text" value="Field 2">
+ </form>
+ <div id="other">
+ Trigger the handler
+ </div>
+ The event handler can be bound to the first input field:
+ $( "#target" ).on( "blur", function() {
+ alert( "Handler for `blur` called." );
+ } );
+
.trigger( "blur" )
:
+
+ $( "#other" ).on( "click", function() {
+ $( "#target" ).trigger( "blur" );
+ } );
+
blur
event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the blur
event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping blur
to the focusout
event in its event delegation methods, .live()
and .delegate()
.
+
"blur"
..on( "blur", ... )
..blur( handler )
or .blur( eventData, handler )
, use .on( "blur", handler )
or .on( "blur", eventData, handler )
, respectively..blur()
, use .trigger( "blur" )
.blur
event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the blur
event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping blur
to the focusout
event in its event delegation methods, .live()
and .delegate()
.
-
ajaxStart
event. Any and all handlers that have been registered with the .ajaxStart()
method are executed at this time.
-
-<div class="trigger">Trigger</div>
-<div class="result"></div>
-<div class="log"></div>
-
-
-$( document ).ajaxStart(function() {
- $( ".log" ).text( "Triggered ajaxStart handler." );
-});
-
-
-$( ".trigger" ).click(function() {
- $( ".result" ).load( "ajax/test.html" );
-});
-
trigger
and the Ajax request is sent, the log message is displayed.
-
"ajaxStart"
.ajaxStart
event. Any and all handlers that have been registered with .on( "ajaxStart", ... )
are executed at this time.
+
+ <div class="trigger">Trigger</div>
+ <div class="result"></div>
+ <div class="log"></div>
+
+
+ $( document ).on( "ajaxStart", function() {
+ $( ".log" ).text( "Triggered ajaxStart handler." );
+ } );
+
+
+ $( ".trigger" ).on( "click", function() {
+ $( ".result" ).load( "ajax/test.html" );
+ } );
+
trigger
and the Ajax request is sent, the log message is displayed.
+
.on( "ajaxStart", handler )
instead..error()
method of the jqXHR
object returned by $.ajax()
or $.ajaxSetup()
is called with the global
option set to false
, the
method will not fire.
+ If $.ajax()
or $.ajaxSetup()
is called with the global
option set to false
, the
event will not fire.
is called on an unordered list (<ul>
) and its <li>
elements have position (relative, absolute, or fixed), the effect may not work properly in IE6 through at least IE9 unless the <ul>
has "layout." To remedy the problem, add the position: relative;
and zoom: 1;
CSS declarations to the ul
.
@@ -65,7 +65,7 @@
Using this selector heavily can have performance implications, as it may force the browser to re-render the page before it can determine visibility. Tracking the visibility of elements via other methods, using a class for example, can provide better performance.
method, must be attached to document
.
+ As of jQuery 1.9, all the handlers for the jQuery global Ajax events, including those added with .on( "
, must be attached to document
.
addClass
and removeClass
.
From 54f5c8eaff50d49f7d0924dd15acf82098528a41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
xhr.responseText
.
blur
event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the blur
event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping blur
to the focusout
event in its event delegation methods, .live()
and .delegate()
.blur
event does not bubble. As of version 1.4.2, jQuery works around this limitation by mapping blur
to the focusout
event in its event delegation methods."blur"
.
-
- .on( "focus", handler )
in the first and second variations, and .trigger( "focus" )
in the third.focus
event is sent to an element when it gains focus. This event is implicitly applicable to a limited set of elements, such as form elements (<input>
, <select>
, etc.) and links (<a href>
). In recent browser versions, the event can be extended to include all element types by explicitly setting the element's tabindex
property. An element can gain focus via keyboard commands, such as the Tab key, or by mouse clicks on the element..focus()
on elements that are visible. To run an element's focus event handlers without setting focus to the element, use .triggerHandler( "focus" )
instead of .focus()
.
-
-<form>
- <input id="target" type="text" value="Field 1">
- <input type="text" value="Field 2">
-</form>
-<div id="other">
- Trigger the handler
-</div>
-
-
-$( "#target" ).focus(function() {
- alert( "Handler for .focus() called." );
-});
-
-
-$( "#other" ).click(function() {
- $( "#target" ).focus();
-});
-
focus
event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the focus
event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping focus
to the focusin
event in its event delegation methods, .live()
and .delegate()
.
-
-
-
-
"focus"
.
+
+ .on( "focus", handler )
in the first and second variations, and .trigger( "focus" )
in the third.focus
event is sent to an element when it gains focus. This event is implicitly applicable to a limited set of elements, such as form elements (<input>
, <select>
, etc.) and links (<a href>
). In recent browser versions, the event can be extended to include all element types by explicitly setting the element's tabindex
property. An element can gain focus via keyboard commands, such as the Tab key, or by mouse clicks on the element..trigger( "focus" )
on elements that are visible. To run an element's focus event handlers without setting focus to the element, use .triggerHandler( "focus" )
instead of .trigger( "focus" )
.
+
+ <form>
+ <input id="target" type="text" value="Field 1">
+ <input type="text" value="Field 2">
+ </form>
+ <div id="other">
+ Trigger the handler
+ </div>
+
+
+ $( "#target" ).on( "focus", function() {
+ alert( "Handler for `focus` called." );
+ } );
+
+
+ $( "#other" ).on( "click", function() {
+ $( "#target" ).trigger( "focus" );
+ } );
+
focus
event does not bubble. As of version 1.4.2, jQuery works around this limitation by mapping focus
to the focusin
event in its event delegation methods.
+
+
+
+
"focus"
..on( "focus", ... )
..focus( handler )
or .focus( eventData, handler )
, use .on( "focus", handler )
or .on( "focus", eventData, handler )
, respectively..focus()
, use .trigger( "focus" )
..blur( handler )
or .blur( eventData, handler )
, use .on( "blur", handler )
or .on( "blur", eventData, handler )
, respectively..blur()
, use .trigger( "blur" )
..blur( handler )
or .blur( eventData, handler )
, use .on( "blur", handler )
or .on( "blur", eventData, handler )
, respectively..blur()
, use .trigger( "blur" )
..focus( handler )
or .focus( eventData, handler )
, use .on( "focus", handler )
or .on( "focus", eventData, handler )
, respectively..focus()
, use .trigger( "focus" )
..focus( handler )
or .focus( eventData, handler )
, use .on( "focus", handler )
or .on( "focus", eventData, handler )
, respectively..focus()
, use .trigger( "focus" )
.blur
event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <input>
. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.
- <form>
- <input id="target" type="text" value="Field 1">
- <input type="text" value="Field 2">
- </form>
- <div id="other">
- Trigger the handler
- </div>
- The event handler can be bound to the first input field:
- $( "#target" ).on( "blur", function() {
- alert( "Handler for `blur` called." );
- } );
+<form>
+ <input id="target" type="text" value="Field 1">
+ <input type="text" value="Field 2">
+</form>
+<div id="other">
+ Trigger the handler
+</div>
+The event handler can be bound to the first input field:
+$( "#target" ).on( "blur", function() {
+ alert( "Handler for `blur` called." );
+} );
.trigger( "blur" )
:
- $( "#other" ).on( "click", function() {
- $( "#target" ).trigger( "blur" );
- } );
+$( "#other" ).on( "click", function() {
+ $( "#target" ).trigger( "blur" );
+} );
blur
event does not bubble. As of version 1.4.2, jQuery works around this limitation by mapping blur
to the focusout
event in its event delegation methods.
-
@@ -27,19 +26,19 @@
.on( "focus", handler )
in the first and second variations, and .trigger( "focus" )
in the third.focus
event is sent to an element when it gains focus. This event is implicitly applicable to a limited set of elements, such as form elements (<input>
, <select>
, etc.) and links (<a href>
). In recent browser versions, the event can be extended to include all element types by explicitly setting the element's tabindex
property. An element can gain focus via keyboard commands, such as the Tab key, or by mouse clicks on the element.
- <form>
- <input id="target" type="text" value="Field 1">
- <input type="text" value="Field 2">
- </form>
- <div id="other">
- Trigger the handler
- </div>
+<form>
+ <input id="target" type="text" value="Field 1">
+ <input type="text" value="Field 2">
+</form>
+<div id="other">
+ Trigger the handler
+</div>
- $( "#target" ).on( "focus", function() {
- alert( "Handler for `focus` called." );
- } );
+$( "#target" ).on( "focus", function() {
+ alert( "Handler for `focus` called." );
+} );
- $( "#other" ).on( "click", function() {
- $( "#target" ).trigger( "focus" );
- } );
+$( "#other" ).on( "click", function() {
+ $( "#target" ).trigger( "focus" );
+} );
focus
event does not bubble. As of version 1.4.2, jQuery works around this limitation by mapping focus
to the focusin
event in its event delegation methods.
.focusin( handler )
or .focusin( eventData, handler )
, use .on( "focusin", handler )
or .on( "focusin", eventData, handler )
, respectively..focusin()
, use .trigger( "focusin" )
..on( "focusin", handler )
in the first two variations, and .trigger( "focusin" )
in the third.focusin
event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the focus event in that it supports detecting the focus event on parent elements (in other words, it supports event bubbling).
+
+
-
-
"focusin"
..on( "focusin", ... )
..focusout( handler )
or .focusout( eventData, handler )
, use .on( "focusout", handler )
or .on( "focusout", eventData, handler )
, respectively..focusout()
, use .trigger( "focusout" )
..on( "focusout", handler )
when passed arguments, and .trigger( "focusout" )
when no arguments are passed.focusout
event is sent to an element when it, or any element inside of it, loses focus. This is distinct from the blur event in that it supports detecting the loss of focus on descendant elements (in other words, it supports event bubbling).focusout
count and the blur
count. (The blur
count does not change because those events do not bubble.)
+
+
-
-
"focusout"
..on( "focusout", ... )
.
+]]>
+]]>
+]]>
+]]>
+]]>