Check documentation for the latest version of dhtmlxSuite loadFromHTML DHTMLX Docs

loadFromHTML

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)

Example

<!-- add div on the page -->
 
<body> 
  <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  
    </div>    
  </div>
</body>    
 
//init menu
<script>
    menu.loadFromHTML("menuData", true, function(){});
    // or
    function doOnLoad(){
        // your code here
    }
    menu.loadFromHTML("menuData", true, doOnLoad)
</script>

Back to top