kml
kml

Reputation: 541

Disable keyboard events from svg inside html5 page

I import an svg file inside a html5 page. For mouse events we have the attribute pointer-events that we can set to false to stop events but there is not any equivalent attribute for keyboard events. I have a js functions "document.onkeydown" that I want to be able to prevent from firing. Any help?

Upvotes: 0

Views: 93

Answers (1)

Sagar Parikh
Sagar Parikh

Reputation: 306

just add a listener for the respective events and return false.

document.onkeydown = document.onkeyup = document.onkeypress = function (e){
        return false;
}

Upvotes: 1

Related Questions