Toggle switch with http-functions

Hi All

I am very new to Wix and the wix-http-function and would really like some help

I am looking to get the state of toggle switch the “toggled or not toggled position” this can be true or false or a value 1 or 0 using the wix-http-function, My reason for this will be to control an action on a local sever.

Thank you

Hi,
I’m a bit new to all this too, but I found this: Switch - Velo API Reference - Wix.com in the docs. I don’t know if you have seen that already though.
Monette

1 Like

Hi Mark!

The switch elements already has this method for you!
Take a look at the property of ‘checked’ at the documentation that Monette shared.

You’ll need to check the value on every change so you can keep the value and action updated as needed.
It’ll probably look something like that:

export function switch_click(event) {
     if($w('#switch1').checked) {
        //Do something
        
   } else {
        //Do something else
        } 
}

Doron.

2 Likes