Redirect using switch input

Hello,
Please can someone tell me how can I redirect users with the new switch input.
For example:


I will be very pleased if someone can give me the code for this.
Thanks very much in advance!

Hi,

You could use Wix Code to interact with the switch input from the Editor, listen to its events and react with redirect as described in https://www.wix.com/code/home/forum/questions-answers/how-to-redirect

Thanks
Adi

Thank you. Please can you give me the code for the switch with on_change event?

Hi,
Your code should look like this:

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

Good luck :slight_smile:

Thank You very very much. Everything is working good!