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 7033335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:03:12+00:00 2026-05-28T01:03:12+00:00

I have the jstree search plugin working fine inside a HTML page. The data

  • 0

I have the jstree search plugin working fine inside a HTML page. The data for the tree is loaded with ajax, and the search is permformed with ajax.

Everything works fine until I put it in another form.

If I put the same code inside a HTML form it doesn’t work anymore because the search is not performed.

The search is not performed because the whole form is submitted when I click the search button of the plugin.

How do I catch the click on the search button and prevent the whole form to be submitted ?

The global form has its own submit button and it still works fine.

I tried the solution in this thread but it doesn’t work :
http://groups.google.com/group/jstree/browse_thread/thread/7945aa59fca2d9c9

Also this does not work :

<form id="list" name="list" action="save.php" method="post">

    <!-- jstree button and input text for search plugin -->
    <div id="mmenu">
        <input type="submit" id="search" value="Go" />
        <input type="text" id="text" value=""  />
    </div>

    <!-- the tree container -->
    <div id="indexation" class="indexation"></div>

    <input id="url" type="text" name="url" value="" size="30" title="www.example.org"/>

    <input type="submit" name="sendform" value="Save" />
</form>
<script type="text/javascript">
// Code for the menu buttons
     $(document).ready(function(){

    $("#mmenu input").click(function () {
        switch(this.id) {
            case "add_default":
            case "add_folder":
                $("#indexation").jstree("create", null, "last", {
            "attr" : {
            "rel" : this.id.toString().replace("add_", "") }
                });
                break;
            case "search":
                $("#indexation").jstree("search", document.getElementById("text").value);
                break;
            case "text": break;
            default:
                $("#indexation").jstree(this.id);
            break;
        }
    });
});
</script>

Any idea/tip would be greatly appreciated

Here is the jsfiddle :

http://jsfiddle.net/v9VRr/6/

thank you,

  • 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-28T01:03:13+00:00Added an answer on May 28, 2026 at 1:03 am

    I found a solution, not really clever but at least it works. Just put the jstree html needed for search outside of the form elements :

    <form id="list" name="list" action="save.php" method="post">
    
    <!-- the tree container -->
    <div id="indexation" class="indexation"></div>
    
    <input id="url" type="text" name="url" value="" size="30" title="www.example.org"/>
    <input type="submit" name="sendform" value="Save" />
    
    <form>
    
    <!-- jstree button and input text for search plugin -->
    <div id="mmenu">
        <input type="submit" id="search" value="Go" />
        <input type="text" id="text" value=""  />
    </div>
    

    Then position the div id=”mmenu” where you need it via CSS.

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

Sidebar

Related Questions

I Have implemented JSTREE on my project everything work fine but recently I faced
I'm trying to get the jstree plugin working, following the Predefined HTML example on
I have a tree generated with JSTree in my JSP page (part of a
can the popular javascript tree views (jstree, dynatree...) be setup to read data from
I am using jstree and several nodes in my tree have the same name.
The JStree plugin for jQuery allows you to load data to feed a navigable
I have a page that contains 8 jstree's, 3 of which are very large.
I'm working on my first app using JStree and I have it doing almost
On my page, i have a button, which on clicked, refreshes a jstree found
I have a nice jstree that loads data and so on - now I

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.