# dhtmlxmenu:api_method_dhtmlxmenuobject_loadfromhtml [DHX documentation]

DHTMLX Docs & Samples Explorer

Index
dhtmlxmenu
API Methods

### loadFromHTML(objId, clearAfterAdd, onLoadFunction)

Required library edition:
Required library file: dhtmlxmenu_ext.js

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

- object - html data container
- clearAfterAdd - true|false, removes the container object after the data is loaded
- onLoadFunction - is called after the data is loaded (but before clearing html content if clear is set to true)

for example, 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>

initing menu

        <script>
            menu.loadFromHTML("menuData", true, function(){});
            // od
            function doOnLoad(){
                // code here
            }
            menu.loadFromHTML("menuData", true, doOnLoad);
        </script>