选中iframe中的所有复选框(邀请客人参加Facebook活动时) [英] Check all checkboxes inside an iframe (when inviting guests to a facebook event)

查看:97
本文介绍了选中iframe中的所有复选框(邀请客人参加Facebook活动时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我邀请客人参加Facebook活动时,我正在尝试选中所有复选框.我认为Facebook更改了某些内容,因为我通常使用此代码,但现在却无法正常工作:

i'm trying to check all checkboxes when inviting guests to a facebook event. Facebook has changed something i think beacuse i usually used this code and now it is not working:

var elms=document.getElementsByName("checkableitems[]");
var lunghezza = elms.length;
for (i=0;i<lunghezza ;i++){if (elms[i].type="checkbox" )elms[i].click()};

我发现邀请客人的模式窗口位于iframe内,但我无法选中其中的复选框!

I discovered that the modal windows to invite guests is inside an iframe but i can't checkboxes inside it!

我用过

jQuery('iframe#iframe_sbx_id').find('input[type=checkbox]').click()

,但是它不起作用,因为find()返回一个空集.对如何做有任何想法吗?

but it doesn't work because find() returns an empty set. Any idea on how to do it?

推荐答案

您可以使用 contents() 来访问iframe的内容,但是由于它位于另一个域中,因此无法使用:

You could use contents() to access the content of the iframe, but because it's on another domain, it won't work:

.contents()方法也可以是 用于获取内容的文档 iframe(如果iframe位于同一台上) 域作为主页.

The .contents() method can also be used to get the content document of an iframe, if the iframe is on the same domain as the main page.

这篇关于选中iframe中的所有复选框(邀请客人参加Facebook活动时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆