Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5966067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:44:22+00:00 2026-05-22T19:44:22+00:00

using jsTreev pre 1 stable and hotkeys plugin. I have a function that is

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:44:24+00:00Added an answer on May 22, 2026 at 7:44 pm

    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.

    jQuery("#tree").jstree({
      plugins: [ "themes","html_data","ui","crrm", "hotkeys" ],
      hotkeys: {
        "return" : function () {
          $hovered = $('#tree .jstree-hovered');
          if ($hovered.length) {
            alert('Hovered node text: ' + $hovered.text());
          } else {
            alert('No element was hovered over when return was pressed');
          }
        }
      }
    });
    

    Working example at http://jsfiddle.net/y7XVp/16/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I'm using jsTree and I have 2 textboxes: <input type=text id=previous_tree_id value= /><hr />
I'm using jsTree 1.0. And have this code : $(document).ready(function () { $(#folders_tree).jstree({ core:
using ASP.NET MVC, I have a Model, to which I'm attaching attributes so that
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C#, I need a class called User that has a username, password, active
I'm using jstree plugin altogether with filament group buttons on the web page. I
Silly question. A lot of examples using jstree that I find on the web
I am currently using dynaTree jQuery plugin to render a tree. <div id=tree style=height:100px;>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.