Where to place code

/ Import statement go at the top of your code, outside of onReady()

import wixWindow from 'wix-window';

// Initialization statements without $w() don't need to be in onReady()

let hideCount = 0;

// Code you want to run when the page loads

$w.onReady(function () {

console.log(`Device viewing site is: ${wixWindow.formFactor}`);

// Initialize an element property

$w("#myTextElement").text = "Hover over to hide";

// Call a function on an element to set its initial state


// Dynamic event handler to be bound when the page loads

$w("#myTextElement").onMouseIn( (event) => {


console.log(`Hidden ${++hideCount} times`);


} );

} );

// Static event handler

export function buttonReset_onClick(event) {