switch1 checked not working ? it not showing with code

switch1 checked not working ? it not showing with code

if ( $w('#switch1').checked ){
  $w('#input1').show();
  $w('#input2').show();
  $w('#loginButton').show();
  $w('#button1').hide();
  $w('#button5').hide();
  $w('#text48').show();
      $w('#text49').hide();
     $w('#input3').hide();
     $w('#button3').hide(); 
}
else {
  $w('#text48').hide();
  $w('#input1').hide();
  $w('#input2').hide();
  $w('#loginButton').hide();
  $w('#button5').show();
  $w('#button1').show();
      $w('#text49').hide();
     $w('#input3').hide();
     $w('#button3').hide(); 
}

Br

Hi,
Have you tried to console log to see the value?

console.log(  $w('#switch1').checked ) 

Tal.

what to do if the switch is in different page and the element i want to toggle is in different page