Ticket #9195 (closed bug: invalid)
Calling on $('#<domID>') within an iFrame fails
| Reported by: | anonymous | Owned by: | anonymous |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.next |
| Component: | misc | Version: | 1.6 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I'm developing a Facebook app at the moment using jQuery 1.6. The facebook app interphace reequires that your app runs within an iFrame on facebook.
In this case, jQuery within the iframe fails to get DOM elements within the iFrame using $('#<domID>'), it returns null. My guess is that jQuery by default searches for dom elements at the parent level/top frame.
Example
<html> <head></title>This is facebook</title></head> <body> <iframe src=" http://example.com/yourapp.html">
<html>
<head>
<title>My App</title> <script type="text/javascript">
$.checkDom = function() {
alert($('#someobj')); NULL
}
</script>
</head> <body>
<input type="text" id="someobj" value="hello" onclick="$.checkDom()" />
</body>
</html>
</iframe> </body> </html>
Change History
comment:1 Changed 2 years ago by rwaldron
- Owner set to anonymous
- Status changed from new to pending
- Component changed from unfiled to misc
comment:2 Changed 2 years ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

would help if you actually included jQuery in your iframe doc