I have a custom HTML field in the form of a button. When clicked, the button does some processing, at one point producing a variable that I would like to capture in a field on the form so I can save it to the repository.
I've been able to pull a value from the HTML by using "document.getElementById" on an attribute, but it only retrieves the beginning value and not the value after it's properly populated.
I start with:
<div id="thirdFrame" style="display:none">
<p id="para">a</p>
</div>
And a script is run inside the button that ends with calling
document.getElementById("para").innerHTML="different text"
But in the CSS and JavaScript part of my form, when I call
var sometext = document.getElementById('para');
$('#q35 input').val(sometext.innerHTML);
The field gets filled with "a" every time, not "different text."
I feel like I'm very close to the solution, but I'm not experienced with this type of coding. Is there a way I can have the CSS and JavaScript fill the field in with the final value, not the beginning value?
I believe all I really need is to know how to have the CSS and JavaScript part of a form wait for a button inside the iframe to be clicked.
Thanks