-1

I need to set a value to an input field that is located (deep) inside an iframe. This input has no id, name or class.

Code extract

Is this possible?

I can't simply add an id or the like because the code is coming from an outside source: enter image description here

j08691
  • 204,283
  • 31
  • 260
  • 272
muchotaco
  • 31
  • 5

1 Answers1

0

If there is only one <input> element, you can refer to it by tag name. With jQuery, you would write:

$("iframe#sq-postal-code").contents().find('input')

Note that this may fail with pages coming from outside, due to same origin policy enforced by modern browsers.

Source

Mario Cianciolo
  • 1,223
  • 10
  • 17