Hi Wix Peps,
Hope things are well with you.
I have three dropdown and I wanted to change the background simultaneously for onchange on each dropdown. I have learned also that setting the backgroundColor is only applied to the Regular Background Color, right? All opacity is set to 100%. here is the code:
$w.onReady(function () { $w('#dropdown1').onChange(() => { $w('#dropdown1').style.backgroundColor = "#000000"; // Not working $w('#dropdown1').style.color = "#FF0000"; // This one is working so why not backgroundColor?? $w('#dropdown2, #dropdown3').style.backgroundColor = "#0000FF"; $w('#dropdown2, #dropdown3').style.color = "#000000"; }); $w('#dropdown2').onChange(() => { $w('#dropdown2').style.backgroundColor = "#000000"; // Not Working $w('#dropdown2').style.color = "#FF0000"; $w('#dropdown1, #dropdown3').style.backgroundColor = "#0000FF"; $w('#dropdown1, #dropdown3').style.color = "#000000"; }); $w('#dropdown3').onChange(() => { $w('#dropdown3').style.backgroundColor = "#000000"; // Not Working $w('#dropdown3').style.color = "#FF0000"; $w('#dropdown2, #dropdown1').style.backgroundColor = "#0000FF"; $w('#dropdown2, #dropdown1').style.color = "#000000"; }); }); The problem is the dropdown background seems to stay on "Focus Background Color" right after I call onchange function. For example the first code, the dropdown 2 & 3 does change its background color but the dropdown 1 stay on the Focus Background Color yet the dropdown 1, 2 & 3 text color change to what I wanted.
This "$w('#dropdown1').style.backgroundColor" will only showed up when making a second click but it will loss the magic.
Hope to hear from you peps, DA