Satch3000
Satch3000

Reputation: 49384

Using keyup in an iframe Possible?

I am using keyup to do some updating on a timer and it works well.

$('.myClass').keyup(function(){typingTimer = setTimeout(doneTyping, doneTypingInterval);});

My problem is that I now need to do the same but calling an ID which is in an iframe.

For Example:

$('#myiFramesID').keyup(function(){typingTimer = setTimeout(doneTyping, doneTypingInterval);});

<iframe name="myiFramesID" id="myiFramesID" .... >

I've tried adding the ID of the iframe but it's not working ... is this at all possible?

Upvotes: 0

Views: 1449

Answers (1)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324640

document.getElementById('myiFramesID').contentWindow.onkeyup = ...

You must attach the event to the content of the iframe, not to the iframe itself.

Upvotes: 3

Related Questions