Check documentation for the latest version 6.0 of dhtmlxSuite loadFromHTML DHTMLX Docs


loads menu data from an HTML file and calls onLoadFunction when loading is done

void loadFromHTML(HTMLElement object,boolean clearAfterAdd,function onLoadFunction);


objectHTMLElementHTML data container
clearAfterAddbooleantrue/false, removes the container object after the data is loaded
onLoadFunctionfunctionis called after the data is loaded (but before clearing HTML content, if clearAfterAdd is set to true)


<!-- add div on the page -->
  <div id="menuData" style="display: none;">  
    <div id="m1" text="File"> // the first top menu item
       <div id="m11" text="New" <hotkey>Ctrl+N</hotkey></div>// the first child item
       <div id="ms1" type="separator"></div> // a separator 
       <div id="m12" text="Open"><hotkey>Ctrl+O</hotkey></div> // the second child item  
//init menu
    menu.loadFromHTML("menuData", true, function(){});
    // or
    function doOnLoad(){
        // your code here
    menu.loadFromHTML("menuData", true, doOnLoad)

Back to top