-1

how to write code for shortcut key html5 like below image link.

http://screencast.com/t/iHOJqwy9

Go Go lu
  • 191
  • 1
  • 1
  • 9
  • Sorry, but this question is not in a form considered on-topic here. Please read http://stackoverflow.com/help/how-to-ask and edit your question accordingly. Thanks! – arkascha Mar 06 '16 at 09:05

1 Answers1

0

Seems a duplicate question but few possible solutions are:

How to detect Ctrl+V, Ctrl+C using JavaScript?

$(document).ready(function()
{
    var ctrlDown = false;
    var ctrlKey = 17, vKey = 86, cKey = 67;
$(document).keydown(function(e)
{
    if (e.keyCode == ctrlKey) ctrlDown = true;
}).keyup(function(e)
{
    if (e.keyCode == ctrlKey) ctrlDown = false;
});

$(".no-copy-paste").keydown(function(e)
{
    if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey)) return false;
});

});


$(document).bind('keydown', 'ctrl+c', function(event){   
$.fancybox.close(); // if this is commented out, CTRL-C works just fine
return true;

});


$(document).keydown(function(e) {
if (e.keyCode == 67 && e.ctrlKey) {
    /* do your stuff */

    $("#test").text("copied!"); /* optional */
}

});

jquery hotkeys and CTRL-C

Community
  • 1
  • 1
Sami
  • 3,686
  • 4
  • 17
  • 28