
<script type="text/javascript" src="http://static.jstree.com/v.1.0pre/jquery.js"></script>
<script type="text/javascript" src="http://static.jstree.com/v.1.0pre/_docs/syntax/!script.js"></script>
<script type="text/javascript" src="http://static.jstree.com/v.1.0pre/jquery.cookie.js"></script>
<script type="text/javascript" src="http://static.jstree.com/v.1.0pre/jquery.hotkeys.js"></script>
<script type="text/javascript" src="http://static.jstree.com/v.1.0pre/jquery.jstree.js"></script>


<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.0.9/themes/default/style.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.0.9/jstree.min.js"></script>


<script>

//http://phpflow.com/php/dynamic-tree-with-jstree-php-and-mysql/

$(function() {

    $(".search-input").keyup(function() {

        var searchString = $(this).val();
        console.log(searchString);
        $('#jstree').jstree('search', searchString);
    });


    $('#jstree').jstree({
        'core': {

            'data': [{
                "id": "1.0",
                "text": "Fresh Products",
                "icon": "",
                "state": {
                    "opened": false,
                    "disabled": false,
                    "selected": false
                },
                "children": [{
                    "id": "2.06.0",
                    "text": "Ethnic & Specialty",
                    "icon": "",
                    "state": {
                        "opened": false,
                        "disabled": false,
                        "selected": false
                    },
                    "children": false,
                    "liAttributes": null,
                    "aAttributes": null
                }, {
                    "id": "2.07.0",
                    "text": "Natural & Organic",
                    "icon": "",
                    "state": {
                        "opened": false,
                        "disabled": false,
                        "selected": false
                    },
                    "children": false,
                    "liAttributes": null,
                    "aAttributes": null
                }, {
                    "id": "2.08.0",
                    "text": "Prepared Foods",
                    "icon": "",
                    "state": {
                        "opened": false,
                        "disabled": false,
                        "selected": false
                    },
                    "children": false,
                    "liAttributes": null,
                    "aAttributes": null
                }, {
                    "id": "2.09.0",
                    "text": "Seafood",
                    "icon": "",
                    "state": {
                        "opened": false,
                        "disabled": false,
                        "selected": false
                    },
                    "children": false,
                    "liAttributes": null,
                    "aAttributes": null
                }, {
                    "id": "2.010.0",
                    "text": "Seafood",
                    "icon": "",
                    "state": {
                        "opened": false,
                        "disabled": false,
                        "selected": false
                    },
                    "children": false,
                    "liAttributes": null,
                    "aAttributes": null
                }],
                "liAttributes": null,
                "aAttributes": null
            }, {
                "id": "2.0",
                "text": "Frozen Products",
                "icon": "",
                "state": {
                    "opened": false,
                    "disabled": false,
                    "selected": false
                },
                "children": [],
                "liAttributes": null,
                "aAttributes": null
            }, {
                "id": "3.0",
                "text": "Store Equipment ",
                "icon": "",
                "state": {
                    "opened": false,
                    "disabled": false,
                    "selected": false
                },
                "children": [],
                "liAttributes": null,
                "aAttributes": null
            }, {
                "id": "4.0",
                "text": "Packaged Grocery",
                "icon": "",
                "state": {
                    "opened": false,
                    "disabled": false,
                    "selected": false
                },
                "children": [],
                "liAttributes": null,
                "aAttributes": null
            }, {
                "id": "5.0",
                "text": "Retail Technology",
                "icon": "",
                "state": {
                    "opened": false,
                    "disabled": false,
                    "selected": false
                },
                "children": [],
                "liAttributes": null,
                "aAttributes": null
            }, {
                "id": "6.0",
                "text": "HBC/Non-Foods",
                "icon": "",
                "state": {
                    "opened": false,
                    "disabled": false,
                    "selected": false
                },
                "children": [],
                "liAttributes": null,
                "aAttributes": null
            }]



        },
        "search": {

            "case_insensitive": true,
            "show_only_matches" : true


        },

        "plugins": ["search"]


    });
});

</script>

<div>
    <input class="search-input form-control"></input>
</div>

<div id="jstree">
   
</div>