Function: previousSibling(domElementOrStringMarkupOrCSSSelector, functionConfirm(domElement)) Shorthand: previous(domElementOrStringMarkupOrCSSSelector, functionConfirm(domElement)) Description: Returns the previous sibling element. Returns: domElement, or $A object if chained. Note: When the second parameter is undefined, previousSibling() returns the previous sibling DOM element. When the second parameter is set to a function however, it must return true in order for the current node to be returned. This exists for cases when specific criteria are needed, such as a matching tag name or element type. Example: // Return the previous sibling DOM element. var myElement = $A.previousSibling(domElement); // Return the previous sibling DOM element, but only when specific criteria is confirmed. var myElement = $A.previousSibling(domElement, function(node) { if (node.nodeName.toLowerCase() === "h2") return true; }); // Or the same using chaining // Return the previous sibling DOM element. var myChain = $A(domElement).previousSibling(); // Return the previous sibling DOM element, but only when specific criteria is confirmed. var myChain = $A(domElement).previousSibling(function(node) { if (node.nodeName.toLowerCase() === "h2") return true; }); // To return the modified element within a chain, use the "return()" method. var myElement = myChain.return();