Yesterday, 14:40
I need to change the color of a switch from JavaScript when the state of another field changes.
Where can I find the widget specifications?
Thanks a lot
Visu.on('widget-ready', 44, ({ widget }) => {
const el = widget.getEl()
if (el) {
widget.listen('32/1/10', (value) => {
el.querySelector('.switch')
el.style.setProperty('--visu-widget-color', value ? 'red' : 'blue')
})
}
})
Where can I find the widget specifications?
Thanks a lot
Visu.on('widget-ready', 44, ({ widget }) => {
const el = widget.getEl()
if (el) {
widget.listen('32/1/10', (value) => {
el.querySelector('.switch')
el.style.setProperty('--visu-widget-color', value ? 'red' : 'blue')
})
}
})