Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
javascript でドキュメントの孫の div と iframe を取得するにはどうすればよいですか? 私はdivのIDとiframeの名前を持っています
使用する.querySelectorAll()
.querySelectorAll()
例:
document.querySelectorAll("#iframeId .someSelector");
子供のIDを持っている場合は、それを使用できます:
document.getElementById("divId");
または、次のようにセレクターを組み合わせて使用することもできます。
document.querySelectorAll("#iframeId > .someSelector > *");