$w( )


Selects and returns elements from a page.

The $w() function selects single or multiple elements by ID or type.

To select by ID, pass a selector string with the hash symbol (#) followed by the ID of the item you want to select (e.g. "#myElement"). The function returns the selected element object.

To select by type, pass a selector string with the name of the type without the preceding # (e.g. "Button"). The function returns an array of the selected element objects. An array is returned even if one or no elements are selected.

To select using multiple selectors, pass a selector string with multiple selectors separated by commas. The selectors in the comma-separated string can be ID selectors, type selectors, or a mixture of the two. The function returns an array of the selected element objects. An array is returned even if one or no elements are selected. If two or more selectors select the same element, it's still returned only once in the array.

Note: Most elements accessible for selection by $w have basic API properties and functions, like id, type, show(), hide(), and others. Use Velo's autocomplete in the code panel to see which API functions and properties are available for each element.

Method Declaration
Copy
Method Parameters
selectorstringRequired

A selector or multiple comma-separated selectors.

Returns
Return Type:Element | Array<Element>
Was this helpful?
Yes
No