I am using MetisMenu with a dynamic <div>. When I load a new submenu under this <div>, the plugin stops functioning.
Is there any way to reset the plugin in the success part of my AJAX call? I've tried:
$('#menu').metisMenu({
toggle: false // disable the auto collapse. Default: true.
});
but it's not working.
Calling
should be sufficient to make MetisMenu aware of any new list elements that you have added via an AJAX call.
Make sure that you have added the new objects as
<li>elements under the menu's<ul>. Also check that you have actually updated the DOM (and not just retrieved the new objects from the server) before invokingmetisMenu.(Note that the
toggleoption apparently does not change the initial appearance of the menu, which will initially be collapsed and require a click to expand.)