Bug Tracker

Opened 9 years ago

Closed 9 years ago

#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:
Blocked by: Blocking:

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 (2)

comment:1 Changed 9 years ago by Rick Waldron

Component: unfiledmisc
Owner: set to anonymous
Status: newpending

would help if you actually included jQuery in your iframe doc

comment:2 Changed 9 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

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!

Note: See TracTickets for help on using tickets.