tags:

views:

273

answers:

3

How i can get keydown event on iframe?

+3  A: 

Adding event handler to an iframe using JQuery

$(document.getElementById('iframe_id').contentWindow.document).keydown(function() {
    // my func
});
Ahmed
+3  A: 

You need to access the document of the iframe which is through the ContentWindow object

$(document.getElementById('IFrameId').contentWindow.document).keydown(function(){ alert('Key down!'); });
James
A: 

You can't handle events of iframe instead handles event of body of iframe's src page.

adatapost