Wix Corvid
- Get link
- X
- Other Apps
Introduction:
$w( ):
- Selects and returns elements from a page. String means Id pass # Symbol
- multiple selectors separated by commas.
- If two or more selectors select the same element, it's still returned only once in the array.
- API Properties :-
id
,type
,show()
,hide()
Example:
Select element using Id :
let myElement = $w("#myElement");23let elementType = myElement.type; // "$w.Type"
Select element using by Type:
let typeElements = $w("Type");23let firstOfType = typeElements[0];
Select all the images on the page:
let imageElements = $w("Image");23let firstImage = imageElements[0];
Select element using multiple selector:
let selected = $w("#myElement1, #myElement3, Type");
Select all the page image hide:
$w("Image").hide();
Syntax:
function $w(selector: string): Element | Array<Element>
at( ):
Gets a selector function for a specific context.
$w.onReady( function () {
$w("#myRepeatedImage").onClick( (event) => {
let $item = $w.at(event.context);
$item("#myRepeatedText").text = "Selected";
} );
} )
onReady( ) :
Use the
onReady()
function for code you want to run before the user starts interacting with your page.- Get link
- X
- Other Apps
Comments
Post a Comment