COTG App and $(document).ready

I have a COTG app with multiple “hidden” pages,
image
End user clicks on the button, to see/annotate the page, clicks button to close again.
image
They wanted to know if the page had already been worked on without opening it up to check. I added a function to check for the annotation image and if present change the button text
image
The problem comes up if the end user closes the COTG form and then opens it back up. The button text reverts back to it’s original text in this case “Mirror Measure” not “Mirror Measure-Started”.

I have tried using $(document).ready, onload and various other methods to run the script to change the text back when the form is opened again. But none have worked, this is due to the fact that var image = element[0].getAttribute(‘value’); always returns null when run using .ready/onload etc. From console log in COTG app

image
If you click on a button that runs the script again, then getAttribute(‘value’) returns a value from last time document was opened.

image

Any thoughts on how I can get the correct info when the form initially opens? With out the user having to click on anyting.

Jerry

Hi Jerry,

Can you confirm if by executing the following JavaScript code–where “#element-id” is the ID of your img-element–the value of “attrValue” is undefined?

$(document).ready(function () {
	var attrValue = $("#element-id").attr("value");
});