PDA

View Full Version : getting elements in iframe with jquery



gib65
01-29-2015, 09:44 PM
Hello,

Can anyone tell me how to find an element inside an iframe using jquery?

I've seen examples on the web but nothing works. I've seen:

var iframe = $("iframe"); var elm = $("#elementID", iframe.contents());

var elm = $("#iframeID").contents().find("#elementID");

But these don't help.

molendijk
01-30-2015, 09:39 PM
See http://www.ezzylearning.com/how-to/how-to-find-an-element-in-iframe-using-jquery

gib65
02-03-2015, 10:51 PM
Unfortunately, that does not help.

Does it matter if the element I want is an input element (type="button") buried way deep inside a table cell?

gib65
02-06-2015, 04:17 PM
Solved it.

The link you provided is correct. It's just that the element I was trying to get wasn't loaded yet. I placed to code in a spot after I was sure the iframe content was loaded and it worked.