.on()

Attach an event handler function for one or more events to the selected elements. The .on() method attaches event handlers to the currently selected set of elements in the jQuery object. As of jQuery 1.7, the .on() method provides all functionality required for attaching event handlers. For help in converting from older jQuery event methods, see .bind(), .delegate(), and .live(). To remove events bound with .on(), see .off(). To attach an event that r

.position()

Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. The .position() method allows us to retrieve the current position of an element relative to the offset parent. Contrast this with .offset(), which retrieves the current position relative to the document. When positioning a new element near another one and within the same containing DOM element, .position() is the more useful. Returns an obje

.parent()

Get the parent of each element in the current set of matched elements, optionally filtered by a selector. Given a jQuery object that represents a set of DOM elements, the parent() method traverses to the immediate parent of each of these elements in the DOM tree and constructs a new jQuery object from the matching elements. This method is similar to .parents(), except .parent() only travels a single level up the DOM tree. Also, $( "html" ).parent() me

.one()

Attach a handler to an event for the elements. The handler is executed at most once per element per event type. The .one() method is identical to .on(), except that the handler is unbound after its first invocation. For example: $( "#foo" ).one( "click", function() { alert( "This will be displayed only once." ); }); After the code is executed, a click on the element with ID foo will display the alert. Subsequent clicks will do nothing. This code is

.offsetParent()

Get the closest ancestor element that is positioned. Given a jQuery object that represents a set of DOM elements, the .offsetParent() method allows us to search through the ancestors of these elements in the DOM tree and construct a new jQuery object wrapped around the closest positioned ancestor. An element is said to be positioned if it has a CSS position attribute of relative, absolute, or fixed. This information is useful for calculating offsets f

.off()

Remove an event handler. The .off() method removes event handlers that were attached with .on(). See the discussion of delegated and directly bound events on that page for more information. Calling .off() with no arguments removes all handlers attached to the elements. Specific event handlers can be removed on elements by providing combinations of event names, namespaces, selectors, or handler function names. When multiple filtering arguments are give

:only-child selector

Selects all elements that are the only child of their parent. If the parent has other child elements, nothing is matched. jQuery( ":only-child" ) version added: 1.1.4 Examples: Change the text and add a border for each button that is the only child of its parent. <!do

:nth-last-of-type() selector

Selects all the elements that are the nth-child of their parent in relation to siblings with the same element name, counting from the last element to the first. Because jQuery's implementation of :nth- selectors is strictly derived from the CSS specification, the value of n is "1-indexed", meaning that the counting starts at 1. For other selector expressions such as :eq() or :even jQuery follows JavaScript's "0-indexed" counting. Given a single <ul

:odd selector

Selects odd elements, zero-indexed. See also even. In particular, note that the 0-based indexing means that, counter-intuitively, :odd selects the second element, fourth element, and so on within the matched set. Because :odd is a jQuery extension and not part of the CSS specification, queries using :odd cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. To achieve the best performance when using :odd

:nth-of-type() selector

Selects all elements that are the nth child of their parent in relation to siblings with the same element name. Because jQuery's implementation of :nth- selectors is strictly derived from the CSS specification, the value of n is "1-indexed", meaning that the counting starts at 1. For other selector expressions such as :eq() or :even jQuery follows JavaScript's "0-indexed" counting. Further discussion of this usage can be found in the W3C CSS specific