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

I want to write an application using jsTree that would display and manipulate directory
I am using jsTree to organize pages created by users. Upon right-clicking and pressing
Greetings, I am using jsTree to generatate my hierarchical data. JsTree is generated as
I have been playing with jstree (1.0rc2)+jquery (1.4.2) for the first time with c#.net
I am currently using this http://blogs.sitepoint.com/hierarchical-data-database-2/ method of storing my data. My current database
I am using jquery and c# to dynamically set a radiobuttonlist listitem to selected.
I'm building a rails app that has a page with a jstree object on
For anyone who has some know-how using Combres, this is for you: My Combres.XML
I have the following code in a controller: $this->viewdata->scripts = array( 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', 'jstree/jquery.jstree-1.0-rc2.js', 'jquery.hotkeys-0.8.js',
how can I open/close nodes on double or single click of the node name

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.