jsTree 中有类似 _get_hovered 的东西吗?
使用 jsTreev pre 1 stable 和热键插件。
我有一个在按下“返回”时触发的函数。我想要获取按 Enter 键之前悬停的节点的文本。这段代码$.jstree._focused().get_selected().text()
仅在我用鼠标单击节点然后按 Enter 时才有效。
如何在不使用鼠标的情况下获取文本?
我认为 _get_hovered 会很好。
当我仅使用键盘时,节点的类将按 Enter 键更改并获取新类 jstree-hovered
。我以为我可以以某种方式使用它,但我不知道如何使用它。
using jsTreev pre 1 stable and hotkeys plugin.
I have a function that is fired when 'return' is pressed. I want get text of the node that was hovered before pressing enter. This code $.jstree._focused().get_selected().text()
works ONLY if I click the node with my mouse and then press enter.
How can I get the text without using mouse?
I was thinking that _get_hovered would be nice to have.
when I use only keyboard the class for the node I am going to press enter changes and gets new class jstree-hovered
. I thought I can use it somehow but I don't know how.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,您几乎在问题中提供了自己的解决方案:当 jsTree (非常好)将 jstree-hovered 类添加到当前悬停的节点时,您需要做的就是找到哪个节点此类来自您的“返回”键事件处理代码。
工作示例位于 http://jsfiddle.net/y7XVp/16/
You actually almost provided your own solution within your question: as jsTree (ever so nicely) adds the
jstree-hovered
class to the node that is currently being hovered over, all you need to do is find which node has this class from withing your "return" key event handling code.Working example at http://jsfiddle.net/y7XVp/16/