children ()
Gets the immediate child elements of each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#containerChild").children(); });
children (query)
Gets the immediate child elements matching the query selector expression of each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#containerChild").children("#element1"); });
closest (query)
Gets the closest element matching the query selector expression starting from each element in the set of matched elements. If any element in the set of matched elements matches the selector expression, then they will be returned, otherwise the closest parent element matching the selector expression will be returned.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element1").closest(".container"); });
element ()
Returns a single HTML element from the WebUI object. If the WebUI onject contains no elements or more than one element, then undefined is returned.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let element = ui("#element1").element(); });
elements ()
Returns all HTML elements in the set of matched elements as a JavaScript array.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let elementArray = ui("#containerChild div").elements(); });
eq (index)
Gets the element at the specified index in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#containerChild div").eq(1); });
find (query)
Finds any child elements matching the query selector expression for each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#exampleContainer").find("#containerChild > div"); });
first ()
Gets the first element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#containerChild div").first(); });
has (query)
Determines whether any of the elements descendants within the set of matched elements matches the specified query selector expression.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let hasBorder = ui("#containerChild").has("[class*='border']"); });
is (query)
Determines whether any element within the set of matched elements matches the specified query selector expression.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let isDiv = ui("#containerChild").children().is("div"); });
last ()
Gets the last element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#containerChild div").last(); });
nextSibling ()
Gets the immediate sibling element after each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element0").nextSibling(); });
nextSibling (query)
Gets the immediate sibling element matching the query selector expression after each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element0").nextSibling("div"); });
nextSiblings ()
Gets the all sibling elements after each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element0").nextSiblings(); });
nextSiblings (query)
Gets the all sibling elements matching the query selector expression after each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element0").nextSiblings("div"); });
parent ()
Gets the immediate parent element of each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element1").parent(); });
parent (query)
Gets the immediate parent element matching the query selector expression of each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element1").parent("div"); });
parents ()
Gets the all parent elements of each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element1").parents(); });
parents (query)
Gets the all parent elements matching the query selector expression of each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element1").parents("div"); });
prevSibling ()
Gets the immediate sibling element before each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element2").prevSibling(); });
prevSibling (query)
Gets the immediate sibling element matching the query selector expression before each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element2").prevSibling("div"); });
prevSiblings ()
Gets the all sibling elements before each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element2").prevSiblings(); });
prevSiblings (query)
Gets the all sibling elements matching the query selector expression before each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>/pre>
webui.ready( () => { let matchedElements = ui("#element2").prevSiblings("div"); });
select (query)
Selects all elements matching the query selector expression within each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#containerChild div").select("#element1"); });
siblings ()
Gets all sibling elements for each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element1").siblings(); });
siblings (query)
Gets all sibling elements matching the query selector expression for each element in the set of matched elements.
<div class="container border-sm border-info pad-md" id="exampleContainer"> <div class="row gap-sm pad-items-md text-center" id="containerChild"> <div class="col-bp-2-over border-sm" id="element0">Label 0</div> <div class="col-bp-2-over border-sm" id="element1">Label 1</div> <div class="col-bp-2-over border-sm" id="element2">Label 2</div> </div> </div>
webui.ready( () => { let matchedElements = ui("#element1").siblings("div"); });