javascript - How to listen keyboard events on svg -


i have svg , can draw multiple shapes on svg. requirement want listen keyboard events ctrl+c, ctrl+v, ctrl+d, esc, delete can copy, paste , duplicate selected shape. have no idea listening keyboard events on svg . tried following code no luck !!

 mysvg.on("keydown", function () {         //code handle keydown   }); 

any ? in advance.

because svg not input-type, listen event on window instead:

$(window).on('keypress', function (evt){ ... }) 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -