Created
November 30, 2010 07:18
-
-
Save FGRibreau/721290 to your computer and use it in GitHub Desktop.
jQuery iFrame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Find the iframe in the current document | |
var doc = $('#myIframe').contents()[0]; | |
//Get the iframe's window context | |
var iFrameWindow = 'defaultView' in doc? doc.defaultView : doc.parentWindow; | |
//Now we can get jQuery by doing iFrameWindow.$ or iFrameWindow.jQuery | |
iFrameWindow.$('selector').data('key') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment