Forum Discussion
Borg_Cube
8 months agoCommunity Member
Working with Javascript triggers - how to find button ID's and Classes (States)?
Hi,
I have a JS-script which should change the state of a button when a user enters a certain code into a text-entry field.
However, I'm unable to find the ID and classes of the button anywhere....
Jürgen_Schoene_
Community Member
storyline don't use IDs for slide-objects - only for the default navigation/menu/...
there is a trick to find the element - use the Accessibility / Alt Text
javascript for button 1 (modify with class*):
var myElement = document.querySelector("[data-acc-text='demoText1']");
myElement.classList.add("hidden")
javascript for button 2 (modifiy with style):
var myElement = document.querySelector("[data-acc-text='demoText2']");
myElement.style.backgroundColor = "red";
* "hidden" is one of the storyline used css classes
SharonGoza-f625
7 months agoCommunity Member
This worked great for me. Do you have a list of what you can change with "style"? I tried some others (color, borderColor) and they didn't work.