| CARVIEW |
This property will always be equal to the this of the function.
For mouseout, indicates the element being entered; for mousein, indicates the element being exited.
This can be the element that registered for the event or a child of it. It is often useful to compare event.target to this in order to determine if the event is being handled due to event bubbling. This property is very useful in event delegation, when events bubble.
click
li").hide();]>
- sub item 1-a
- sub item 1-b
- sub item 2-a
- sub item 2-b
When this property is set to true, all animation methods will immediately set elements to their final state when called, rather than displaying an effect. This may be desirable for a couple reasons:
- jQuery is being used on a low-resource device.
- Users are encountering accessibility problems with the animations (see the article Turn Off Animation for more information).
Animations can be turned back on by setting the property to false.
The .each() method is designed to make DOM looping constructs concise and less error-prone. When called it iterates over the DOM elements that are part of the jQuery object. Each time the callback runs, it is passed the current loop iteration, beginning from 0. More importantly, the callback is fired in the context of the current DOM element, so the keyword this refers to the element.
Suppose we had a simple unordered list on the page:
<ul>
<li>foo</li>
<li>bar</li>
</ul>
We can select the list items and iterate across them:
$('li').each(function(index) {
alert(index + ': ' + $(this).text());
});
A message is thus alerted for each item in the list:
0: foo
1: bar
We can stop the loop from within the callback function by returning false.
- Eat
- Sleep
- Be merry
This method behaves differently from using a normal JavaScript eval() in that it's executed within the global context (which is important for loading external scripts dynamically).
Note: This is a low-level method, you should probably use .removeData() instead.
The jQuery.removeData() method allows us to remove values that were previously set using jQuery.data(). When called with the name of a key, jQuery.removeData() deletes that particular value; when called with no arguments, all values are removed.
Note: This is a low-level method; you should probably use .data() instead.
The jQuery.data() method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks. We can set several distinct values for a single element and retrieve them later:
jQuery.data(document.body, 'foo', 52); jQuery.data(document.body, 'bar', 'test');
jQuery.data(element, name, value), or the full data store for the element.Note: This is a low-level method; you should probably use .data() instead.
The jQuery.data() method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks. We can retrieve several distinct values for a single element one at a time, or as a set:
alert(jQuery.data( document.body, 'foo' ); alert(jQuery.data( document.body ));
The above lines alert the data values that were set on the body element. If nothing was set on that element, an empty string is returned.
Calling jQuery.data() with no parameters retrieves all of the values as a JavaScript object.








