Last active
December 21, 2015 21:19
-
-
Save kawanamiyuu/6367312 to your computer and use it in GitHub Desktop.
iframe内のDOMを操作する方法 ref: http://qiita.com/kawanamiyuu/items/0e95f360ad5490e2db74
This file contains 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
var $iframe = $('#some_iframe'); | |
// iframe内のコンテンツのdocumentオブジェクト | |
var ifrmDoc = $iframe[0].contentWindow.document; | |
// あとはいつも通りでおk | |
var $body = $('body', ifrmDoc); | |
var $ele = $('#some_element', ifrmDoc); |
This file contains 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
$(function() { | |
// onload イベント | |
$('#some_iframe').on('load', function(e) { | |
var $body = $('body', this.contentWindow.document); | |
: | |
: | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment