开发者

can not get html inside iframe , and can not fire events of elements inside iframe

开发者 https://www.devze.com 2023-04-09 19:01 出处:网络
i am using Facebook graph API to invite Facebook friends to my codeigniter application , i want to fire a click event inside an element of iframe , but it is not firing , my code is

i am using Facebook graph API to invite Facebook friends to my codeigniter application , i want to fire a click event inside an element of iframe , but it is not firing , my code is

        $("iframe").contents().find('input[name="login"]').live('mouseover',function(){
                          alert("log in");
         });

alert is not shown , no errors in firebug .

but if i do this

    $("iframe").live('mouseover',function(){
                      alert("log in");
     });

this works and give the alert .

but if i try to get html inside iframe

$("iframe").live('mouseover',function() {          
   alert($('.fb_ltr').contents().find('.request').html());                      
});


it gives an error in firebug 


Permission denied to access property 'ownerDocument'
[Break On This Error] shi开发者_如何学Goft(),i.sort());if(!!e&&!f.event.cus...is).get();f(e[h])[b](j),d=d.concat(j

how to use elements inside iframe , i saw similar questions , but could not get a help . please help , thanks ..............................


You are unable to access/manipulate any content via iframe if it's from a different domain.

jQuery/JavaScript: accessing contents of an iframe


The Iframe is treated as a single element.

Thats why your code:

$("iframe").live('mouseover',function(){}); 

works but accessing its element won't

see this jQuery - Trying to select element from iFrame (point and click)

0

精彩评论

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