Question : jQuery hotkeys used in an iframe.

Hello, I have this code that uses http://github.com/tzuryby/hotkeys for Ctrl+s ... But I have an iframe that a user clicks into and text something.. I can't really do much about what is in the iframe... What I need to do is still get the Ctrl+s so I can run my function.  Any ideas on what need to change to make it work without the iframe content being changed (no control on that end).  I know I have seen this done; I just can't seem to remember what is was for so googling has been hard.  Thank you for the help.  Cheers -Jeremy
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
//Supose to work in the iframe with id frame_SIA
 	$("#frame_SIA").contents().find(document).bind('keydown', 'ctrl+s', function(evt) {
		evt.stopPropagation( );   
		evt.preventDefault( ); 
        alert(' trying to save');
				if(!inproccess){
					SSubmit();
				}
	});


//works normally in the parent doc
	$(document).bind('keydown', 'ctrl+s', function(evt) {
    evt.stopPropagation( );   
    evt.preventDefault( ); 
				if(!inproccess){
					SSubmit();
				}
	});

Answer : jQuery hotkeys used in an iframe.

got it.. part timing and part targeting....

      $('#frame_SIA').ready(function() {
            var x=document.getElementById("frame_SIA");
            var y=(x.contentWindow || x.contentDocument);
            $(y.document).bind('keydown', 'ctrl+s', function(evt) {
                  evt.stopPropagation( );  
                  evt.preventDefault( );
            });
      });      
Random Solutions  
 
programming4us programming4us