0

I have a webpage with an iframe which contains two checkboxes - one for yes, one for no.

What I'm trying to do is check if one of the checkboxes is ticked, and if so, display an alert.
I have tried various methods including plain JS and JQuery such as

function validate(){
   var frame = document.getElementById('iFrame1');
   var checkboxes = frame.contentWindow.document.getElementsById('element_0_0');
      if (checkboxes.checked){
        alert("Testing");   
      };
}

When I click the button which calls this function, nothing happens. I put an alert at the beginning which did show, but this main bit of code doesn't seem to do anything.

How can I get this value out from the iframe, please? The checkboxes have different IDs but the same name of 'element_0[]' (the iframe is from a 3rd party source and I can't change it unfortunately).

j08691
  • 190,436
  • 28
  • 232
  • 252
aaron
  • 1
  • 2

0 Answers0