Multi State Box - Creating a 'next' and 'previous' function.



var counter = 1

$w.onReady(function () {
  $w('#btnNext').onClick(()=>{
counter=counter+1
        let currentState = ("State"+counter)
$w('#multiStateBox3').changeState(currentState)
        if(counter>1) {$w('#btnPrevious').show()}

})

$w('#btnPrevious').onClick(()=>{
counter=counter-1
        let currentState = ("State"+counter)
$w('#multiStateBox3').changeState(currentState)
        if(counter===1) {$w('#btnPrevious').hide()}

})

});

This above code is not working for me… can anyone help me?

Whats the problem exactly? State not changing? No click response?