disable all keyup/keydown/keypressed events presen

2020-08-17 05:44发布

I am having plenty of key events here on my page.Is there any way to disable all the keyup/keydown/keypressed events present on page rather than disabling each event separately. i am looking for solution using javascript/jquery.

Thanks!!

7条回答
乱世女痞
2楼-- · 2020-08-17 06:12

$(elem).off('keypress.jstree')

I recently struggled with this as well since I was adding editing features to tree nodes. By looking at the source, I noticed there's an event keypress.jstree being bound with a timeout of 500ms.

Simply adding the above off binding after initializing the tree solved all my issues at once! This works both for static tree structures as well as tree's loaded with ajax data. The version I'm currently using is 3.3.5

Hope this helps.

查看更多
登录 后发表回答