JQuery and Seamless Play
July 7, 2022 12:00 AM
Good afternoon - I have a quick question. My colleague figured out a quick and simple way to obtain the unique ID of an object based on the the class name as shown below.
triv$(".tmpbutton").first().attr("id")
While this works fine, it doesn't work when we publish the content using the Publish for Seamless Play enabled. Is there a way to make it work when that is enabled?
Solutions (2)
Give this a try:
triv$(".tmpbutton", GetDisplayDocument()).first().attr("id")
Learn more here:
https://knowledgebase.elblearning.com/containing-your-containers-custom-javascript-suggestions-for-lectora-online
Note: PascalCase only in older version of Lectora Desktop, PascalCase and camelCase in new versions of each product.
Thanks @wheels , that snippet helped get me to the point of making it work, only a minor modification...
triv$(".tmpbutton", getDisplayDocument()).first().attr("id");
GetDisplayDocument() >> getDisplayDocument()
Not to mention that link you passed along, I hope that will make my life easier - I am not a master at Java/CSS/HTML, but I do know enough to make myself dangerous. Appreciate your time as always.
Discussion (5)
Give this a try:
triv$(".tmpbutton", GetDisplayDocument()).first().attr("id")
Learn more here:
https://knowledgebase.elblearning.com/containing-your-containers-custom-javascript-suggestions-for-lectora-online
Note: PascalCase only in older version of Lectora Desktop, PascalCase and camelCase in new versions of each product.
Hi @wheels, thanks for the link to the document. I'll be saving for future use as well.
I'm curious about the code snippit that you shared. I've never seen a second parameter to jquery like that and can't find any info in jquery documentation. Is this an enhancement that was added on by Lectora?
Thanks @wheels , that snippet helped get me to the point of making it work, only a minor modification...
triv$(".tmpbutton", getDisplayDocument()).first().attr("id");
GetDisplayDocument() >> getDisplayDocument()
Not to mention that link you passed along, I hope that will make my life easier - I am not a master at Java/CSS/HTML, but I do know enough to make myself dangerous. Appreciate your time as always.
It's an option parameter for context.
Thanks @Wheels. Not sure how I missed that in the documentation! :s