twitter bootstrap - How to fire a keyboard shortcut function in JavaScript? -


i have record functionality in website. if user hits ctrl+alt+r recording begin. button named record in html page, when user hits button recording start.

<button type="submit" class="btn btn-primary" data-toggle="tooltip" data-placement="top" onclick="record_session()" title="start recording">record</button> 

in function below

function record_session(){     //how can trigger or initiate  ctrl+alt+r here?? } 

if use jquery can add keypress event:

$(document).keypress(function(e) {     if (e.which === 114 && e.ctrlkey && e.altkey) {         record_session();     } }); 

update:

var enable_keypress = false; function record_session(){     enable_keypress = true; } $(document).keypress(function(e) {     if (enable_keypress) {         if (e.which === 114 && e.ctrlkey && e.altkey) { // ctrl+alt+r          }     } }); 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -