onChange event bug

Hello,
I added a switch input on my page and I need to add an onChange event,when the switch input came out at first, it had an onChange event, but now I can’t find it, please can someone help me? Is it a bug?

You should use the onClick handler.

Dear Yisrael, please can you tell me how can I have this code with onClick event?

 export function switch1_change(event, $w) { 
 if($w('#switch1').checked === true)
 { 	
 wixLocation.to("/blog"); } 
 else{ 		wixLocation.to("/home"); 
 } 
 } 

Hi,
Can you expand more of your purpose???

There are few question.
① Do you want web user switch on/off to go to different page ?? Would menu bar better??
② There are some logical problem.

  • If your switch input default value was false, it means web-user never go to “/home”.

  • It’s because action was started by web-user switch the switch input. Therefore, web-user only can do one single action from this switch input, from false to true.

Dear Heson, I have 2 parts in my website, 1) For adults, 2) For kids. When the user enters my website, he/she is going to be on adults page, after he/she can switch the switch input to go to kids page. I need the code for this. If you can, please help me. Thanks in advance!