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
Borg_Cube
8 months agoCommunity Member
Thank you very much, Jürgen. I'll take a look at this once I'm back at work.