How to Control Symbols Elements with Javascript


#1

I would like to control the innerHTML of a symbol element with unique id “d” contained in a Symbol named “ball_thrown_off_cliff”

Have tried.

hypeDocument.getSymbolInstanceById(‘ball_thrown_offf_cliff’).d.innerHTML = ‘TEST OF D’;

This does not work. Any suggestions appreciated.


(𝕄𝕚𝕔𝕙𝕒𝕖𝕝 𝔾𝕒𝕣𝕠𝕗𝕒𝕝𝕠) #2

Is it the extra “f”?

“off” instead of “offf”


#3

No, that should not be an issue. From your comment it sounds like my syntax is correct.
All other suggestions welcome.
Thanks for your response.


(Lucky) #4

Try directly refferencing it, without putting the symbol part
d.innerHTML=‘blah’;
also try changing the name to something more detailed,
symbolText.innerHTML=‘blah’


#5

No that does not seem to work.


(Lucky) #6

works for me
dyntext.zip (11.7 KB)


#7

It works for me as well. Thanks.

Just starting to work with symbols and wondering what the problem could be with the
"hypeDocument.getSymbolInstanceById(‘ball_thrown_off_cliff’)" part.

Anyway again thanks for the help.