I want a user to be able to change the color of a box on a click, and I can’t find a tutorial for that. Can anyone give me the link of a tutorial on how to hide and show elements in response to a user click? I tried the tutorial called “How to Add Custom Interactions Using Java Script,” but at 3:22 where it says to type in “.” and "scroll to find the function needed, the list that shows up on my screen is different than the tutorial’s list, and there is no option for “show” on mine.
Hello Betty
first make sure your getting the right elements’ ids and using the right syntax.
second:
- to change a box color on click you can do the following:
export function Box_click(event, $w) {
//Add your code for this event here:
$w('#Box').style.backgroundColor = "#FFFFFF";
}
- to hide elements on click:
export function element_click(event, $w) {
//Add your code for this event here:
$w('#element').hide();
}
- to show elements on click:
export function element_click(event, $w) {
//Add your code for this event here:
$w('#element').show();
}
here’s some useful references:
-box style
- hide & show
Best!
Massa
Thank you very much!