Skip to content

Instantly share code, notes, and snippets.

@kawanamiyuu
Last active December 21, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawanamiyuu/6367312 to your computer and use it in GitHub Desktop.
Save kawanamiyuu/6367312 to your computer and use it in GitHub Desktop.
iframe内のDOMを操作する方法 ref: http://qiita.com/kawanamiyuu/items/0e95f360ad5490e2db74
var $iframe = $('#some_iframe');
// iframe内のコンテンツのdocumentオブジェクト
var ifrmDoc = $iframe[0].contentWindow.document;
// あとはいつも通りでおk
var $body = $('body', ifrmDoc);
var $ele = $('#some_element', ifrmDoc);
$(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