How i can get keydown event on iframe?
It's so late to answer but maybe is useful for somebody .
I've same problem,that means I've an iframe inside a HTML page in a same domain.
Now I need to get the Esc keyup event.
however I don't want (or some times I can't) to write any script inside iframe body.
to do it, I use below script to detect what is the parent id of element that selected by clicked on it.
$(window).load(function () {
jQuery(jQuery('[id="frame"]')[0].contentWindow.document).on('keyup', function (e) {
var _currntItem = ($(e.target))
if (e.keyCode === 27) {
alert(_currntItem.parent().attr('id'));
}
});
This code resolved my problem.
hope to useful.