Skip to content

Instantly share code, notes, and snippets.

@rockymanobi
Created November 27, 2015 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockymanobi/516f13bbec0104e177e3 to your computer and use it in GitHub Desktop.
Save rockymanobi/516f13bbec0104e177e3 to your computer and use it in GitHub Desktop.
function startListeningKeyDownEvent(){
$(window).keydown(function(e){
// put the keycode pressed to console
console.log(e.keyCode);
// if it's Enter key, trigger click event on mic button
if( e.keyCode + '' === '13' ){
$('button[mic-id="all"]').trigger('click')
}
return false;
});
}
$(document).ready(()=>{ // or onDeviceReady for cordova
startListeningKeyDownEvent();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment