I tried ur method, but didn't work as well. I have another project that works, where I also get the text from the input with the same line of code as here
can you verify that window.parent.HYPE.documents['index'] exists when calling ...
if your reference is correct the case may be that the Hypedoc is not yet built. then the road to go would be make use of Hypes Events in this case HypeDocumentLoad.
I'm able to type into the input before I run this script, so I assume it exists...
I have another project where I use the exact same code to get the value from an input, there it works fine.
as you can't share the setup ... just log out your path ...
console.log(window.parent)
it does exist ...ok then
console.log(window.parent.HYPE.documents['index'])
the HypeInstance does exist? great next step
console.log(window.parent.HYPE.documents['index'].getElementById("Input1"))
if any of those does not log what you expect ...then expect the html-structure in the browser and see what the real setup is ...
Depending on the setup, it could also be a CORS-related problem ...
////////////
btw there's no need to share the productionfile, but a samplesetup ...would do fine
We are assuming that ;
The parent page (index.html ) has the html button.
And also has an iframe with the script to your second html file.
The second html file
Has a rectangle with the script in its innerHTML
If this is the case your code should work. To test in the browser from the local file system you will likely need to ( in Safari) go to the Developers menu ( turn on in Safari->Settings -> Advanced Tab. and check the Show developer menu, which will show up in the Safari menu bar) and temporarily disable cross origin restrictions.
If you are actually putting both the html button and the script in a single project and not using an iFrame
i.e the button inside one Rectangle innerHTML and the script either inside the same Rectangle or in another one (same scene ) then it will not work and you would simply just use
hypeDocument.getElementById('id'). or document.getElementById('id')
and
This would be the same case if you had this setup and was then using this html project as a src for an iframe. Since every thing you are accessing is in a single doc.