views:

10

answers:

1

I'm creating an IFrame to house an app that wants to listen to keypress events -- is there any way to give this iframe focus, so keypresses get passed to its own handlers, and not to the main page's? (Clicking within the iframe works, but makes for an awful user-interface...)

Thanks!

-B

A: 

calling focus on the iframe itself does the trick. E.g. in jquery:

$("#MyIFrame").focus()
Bosh