can i use "selector" without id or class for special tags? ex. "iframe" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can i use "selector" without id or class for special tags? ex. "iframe"

hi... i have too much iframe on my html page without any id or class is there any way to select iframe tags automaticly... or some tricks...?

17th Feb 2017, 7:08 PM
Hooman Hassanzadeh
Hooman Hassanzadeh - avatar
2 Answers
+ 11
document.getElementsByTagName("iframe")[index]
17th Feb 2017, 7:19 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
document.querySelectorAll("iframe")[index]; ... also works, and in JQuery, something like: $("iframe").get(index); ... should do the trick ^^
17th Feb 2017, 8:20 PM
visph
visph - avatar