开发者

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(开发者_StackOverflow中文版function () {

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

 });

Why isn't this working?


This is why you can't do this.

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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜