Calling Hype parent from internal javascript within that object

I’m trying to call a hype object with in itself. I’m not sure if it is possible… trying so many different ways and no luck… I have rigged up an example.

Trying to change backgroundColor within it’s on javasciprt…

callingParentInHype.hype.zip (18.2 KB)

This seems to work...

var mybackground = parent.document.getElementById('nameBox');

As opposed to this...

var mybackground = hypeDocument.getElementById('nameBox');
1 Like

Thanks again!

Since you know the id of the parent box you can do as Greg suggests and use document to get the nameBox where hypeDocument will not find it but you do not need to get the parent, since you are asking the document to get the element named nameBox.

document.getElementById(‘nameBox’);

2 Likes