1

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()};

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

I've used

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

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

Nicola Peluchetti
  • 76,206
  • 31
  • 145
  • 192

1 Answers1

1

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

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.

Michaël Witrant
  • 7,525
  • 40
  • 44
  • Yes you are right: i get "Error: Permission denied to access property 'ownerDocument'" if i try it. Have you got any idea on how to bypass this? – Nicola Peluchetti May 30 '11 at 07:25
  • There's no way to access an iframe content from another domain. Otherwise you could do terrible things (get the user's friend list, read his mails, etc.). I don't know what Facebook provides. Maybe there's another way (through an API for example). – Michaël Witrant May 30 '11 at 11:48
  • Ok, there is nothing to do, so i accept your answer!Thnx for your hekp! – Nicola Peluchetti Jun 04 '11 at 13:05