Access element id | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Access element id

Would like to ask, if there have 2 files (file A and file B). Is it possible to access element id in file B from file A by JavaScript?...your advice is highly appreciated....

14th Jul 2017, 1:11 AM
Yen
Yen - avatar
2 Answers
+ 2
It may be possible, but in very specific context: you need to open the second page/file in another window/tab/iframe dynalically through the JS code of the first one, and use the referenced new document to access its DOM content... but this will only work for file hosted on same internet domain (must be 'same origin domain') ^^
14th Jul 2017, 6:58 AM
visph
visph - avatar
+ 1
Thx visph, I will try on this.
14th Jul 2017, 7:39 AM
Yen
Yen - avatar