Wix Corvid

 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 :-idtypeshow()hide()
Example:
Select element using Id : 
let myElement = $w("#myElement");
2
3let elementType = myElement.type; // "$w.Type"
Select element using by Type: 
let typeElements = $w("Type");
2
3let firstOfType = typeElements[0];
Select all the images on the page:
let imageElements = $w("Image");
2
3let 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.

 




Comments

Popular posts from this blog

Module-1

React Js Start

Git and GitHub For Project