changeState undefined

My first Velo attempt and it’s suppose to be “beginner”. I created a simple Multi-state box and every time I click the onClick button I get “changeState undefined” error. What basic setup am I doing wrong?

$w . onReady ( function () {

$w ( “#button21” ). onClick (() => {
$w ( “Box” ). changeState ( “Open” );
});

$w ( “#button22” ). onClick (() => {
$w ( “Box” ). changeState ( “Closed” );
});
});

  1. Is your —> BOX <<- really a —> Multistatebox? (Why you do not use also a PLAUSIBLE ID for that element, like —> “msBox” or “msb1” or “multistateBox”, or something like that.

You are really sure, that you have add an MultiStateBox, and not a normal box?

  1. Your states are really defined as —> “Close” & “Open” ???

Check this first.

wix.com/velo/reference/$w/multistatebox/changestate

That was just a placeholder name in my test.

However, stupid syntax error:
$w(“#Box”) instead of $w(“Box”) worked. “Undefined function” error code threw me off; thought I was missing some .js file somewhere. Thanks!

$w . onReady ( function () {
// Put all your $w code here

$w ( “#button21” ). onClick (() => {
$w ( “#Box” ). changeState ( “Open” );
});

$w ( “#button22” ). onClick (() => {
$w ( “#Box” ). changeState ( “Closed” );
});
});