UNPKG

apex4x

Version:

The Comprehensive ARIA Development Suite

37 lines 2.75 kB
�� Function: nextSibling(domElementOrStringMarkupOrCSSSelector, functionConfirm(domElement)) Shorthand: next(domElementOrStringMarkupOrCSSSelector, functionConfirm(domElement)) Description: Returns the next sibling element. Returns: domElement, or $A object if chained. Note: When the second parameter is undefined, nextSibling() returns the next 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 next sibling DOM element. var myElement = $A.nextSibling(domElement); // Return the next sibling DOM element, but only when specific criteria is confirmed. var myElement = $A.nextSibling(domElement, function(node) { if (node.nodeName.toLowerCase() === "h2") return true; }); // Or the same using chaining // Return the next sibling DOM element. var myChain = $A(domElement).nextSibling(); // Return the next sibling DOM element, but only when specific criteria is confirmed. var myChain = $A(domElement).nextSibling(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();