Youss
Youss

Reputation: 4212

How do I acces iframe with Jquery

I have Google in an iframe. I want to have some control over the input so I tried:

  $('#iframeID').contents().find('input').keydown(function () {

     $(".SomeDiv").hide();

 });

Why isn't this working?

Upvotes: 0

Views: 131

Answers (3)

ShankarSangoli
ShankarSangoli

Reputation: 69905

You cannot access the iframe content which is in a different domain than its parent unless you map the domain which mostly is not allowed in all the browsers due to security reasons.

The below link might help you

http://softwareas.com/cross-domain-communication-with-iframes

Upvotes: 1

Lars
Lars

Reputation: 5799

It's hard to answer the question without the underlying code, but have a look at this forum thread. At the bottom is a jQuery example, in which the same problem as you have is solved with jQuery.

Upvotes: 1

Caimen
Caimen

Reputation: 2619

This is why you can't do this.

http://en.wikipedia.org/wiki/Cross-site_scripting

Upvotes: 1

Related Questions