Contextmenu for Treeview

Contextmenu for Treeview

I'm using the "jQuery contextmenu plugin" combined with "jQuery
treeview async plugin" and "jQuery livequery". I use this combination to load in all data into the
treeview from the database. Next step is that I want to be able to
right click these dynamically loaded elements and alert the id of each
element. The contextmenu as such appears in both IE and Firefox, when I right-click a treeview element, but the problem is when I try to select/left click a menu item in the context
menu. Then the binding only works in IE but not in Firefox, meaning that the selected value is alerted in IE, but not in FF.





I'm pulling my hair out here...can anyone help out? 

The js code:

  1. jQuery(document).ready(function(){

            jQuery("#black").treeview({
                            animated: "1",
                            url: "source.php",
                            persist: "cookie",
                            cookieid: "treeview"
                    });

                    jQuery('ul li').livequery(function() {
                    jQuery('span.folder, span.file').contextMenu('theContextMenu', {

                    bindings: {

            'edit': function(t) {

                      alert(t.id);

            },

            'email': function(t) {

              alert('Trigger was '+t.id+'\nAction was Email');

            },

            'save': function(t) {

              alert('Trigger was '+t.id+'\nAction was Save');

            },

            'delete': function(t) {

              alert('Trigger was '+t.id+'\nAction was Delete');

            }

          }

    });


    });

    }); 














































The code in my html file:

  1. <div class="contextMenu" id="theContextMenu">
          <ul>
            <li id="edit"><img src="images/folder.gif" />Edit...</li>
            <li id="email"><img src="images/folder.gif" />Email...</li>
            <li id="save"><img src="images/folder.gif" />Save...</li>
            <li id="delete"><img src="images/folder.gif" />Delete...</li>
          </ul>
        </div>


    <div class="theTree" id="theTree">

    <ul id="black" class="filetree">

    </ul>













</div>

 
  1.