InDom.get(selector, container?)
Shortcut: $aQueries the DOM using the CSS selector and returns an InDomArray of InDom objects for each matching DOM element.
Returns an empty InDomArray if no matching elements are found.Parameters:
Returns an empty InDomArray if no matching elements are found.Parameters:
selector {string} - CSS selector string
container {ParentNode | InDom} (optional) - The container element or InDom object to search within. Defaults to document.
Returns: {InDomArray} - InDomArray object, empty when none foundExamples:// Set style on every '.example'
$a('.example').setStyle('color', 'blue');
// Set click event on every '.example>span'
$a('.example>span').onClick(n => {
n.setStyle('color','green');
});
// The same, written as a single-line arrow function:
$a('.example>span').onClick(n => n.setStyle('color', 'green'));
const example1 = $1('.example');
//Set data 'init': 1 on direct children 'div' of the first '.example'
$a('>div', example1).setData('init', 1);
//InDomArray objects themselves don't have get* methods
//Get the left and top of each '.example>div' relative to viewport
$a('.example>div').each(n => {
// .getBox() returns the bounding box
const box = n.getBox();
console.log(`left:${box.left} top:${box.top}`);
});Next: getById »