HTML tag IDs
October 16, 2017 12:00 AM
I often find myself turning to JavaScript to compensate for the accessibility shortcomings of Lectora. This of involves accessing the HTML element by ID in the published HTML. I just recently realized that these IDs change in the process of revising a course and republishing it (at least when republishing to HTML for testing purposes).
Does anyone know exactly when the HTML IDs are changed by Lectora? It would be very valuable information if you have JavaScript in a title that could be broken by changing IDs of HTML elements. It would be nice to have a good rule of thumb for when to update embedded JavaScript code?
Discussion (2)
Thanks much, Jason. I'll certainly give that a try.
In some cases with JavaScript, you can use "%HTMLNAME%xxx" with the RunJS on an object instead of the actual html ID. I use this on my hide from tab order JS that I add as an onShow - RunJS:
document.getElementById("%HTMLNAME%anc").tabindex="-1";
The "xxx" in the box should be replaced with the last three characters of the object type. For example, anc is used for images, btn is for buttons, etc.
I, too, feel your pain, as I have a page where there's a video that I need to go to a specific time stamp and pause when clicking certain buttons. To do this, I'm using a JS to set the time on the video in combination with events in the video. I have to update the ID any time I copy/paste the page, even within the same course, since it gets a different ID on each page.
Discussions have been disabled for this post