|
closest()
For each element in a set, this function gets the first parent element that matches a selector, by testing the element itself and traversing up through its ancestors in the DOM tree. (In HTML, a parent is an element that contains another element.) To get a child element or all child elements, use The closest(selector)For each element in a set, this function gets the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. selector A String containing an HTML tag (without the angle brackets, <>). ExamplesThe following script looks up all table rows in the template that contain an <input> element.
This code gets the closest 'parent' row for each element that matches the selector of the script (collected in the
The rows could be coloured red within the same statement:
|
|