Forum Discussion
MarkRash865
5 months agoCommunity Member
JavaScript API: Set state to Disabled or Hidden
I'm loving the additional flexibility with the JavaScript API. I've been able to successfully manipulate objects, including states, but for some reason, I bump into an error any time I try to change ...
Nedim
5 months agoCommunity Member
A similar question was raised in this thread. Only the Normal built-in state and custom states can be accessed via the object.state property by referencing the state name. Other built-in states (such as Hover, Visited, Selected, Disabled) are not mapped in slides.js. These states are typically triggered natively by mouse events (like mouseover) or clicks, while custom states are explicitly triggered.
Example of an error when you try to set object.state = "Disabled". You’ll encounter the same issue if you attempt to set object.state to "Visited" or "Selected". However, object.state = "Normal" will work just fine.
Try:
const button1 = object('6CJN2qEzG8V');
button1.state = '_default_Disabled';