The procedure's steps are described below.
- The relevant <iframe> needs to be stored in a variable. Two sample commands:
- var iframe = document.getElementById('TheID');
- var iframe = document.querySelector('iframe[id="TheID"]');
- An element within the iframe is retrieved via the use of contentWindow.
For instance, as
var element = iframe.contentWindow.document.querySelector('form input[type="checkbox"]');
A relevant example can be found here.