I am currently injecting an iframe
and binding a keyevent
both to the document
and the iframe
.
Can I select both the iFrame and the document in one row?
notice the iframe must have .contents()
after the selector
// wait for iframe to load
$('iframe#iframe').load(function() {
// event bind to document
$(document).bind('keydown', function(e) {
console.log("runs document");
});
// event bind to iframe
$(this).contents().bind('keydown', function(e) {
console.log("runs iframe");
});
});