Thanks, that worked, though it's a bit clunky to have to do it that way in my code.
I'd just like to plug again my request for a 'clear'. Otherwise, here's what I'm having to do:
$('.menu-text', menuElem)
.map(function (i, e) {
return e.textContent
})
.each(function (i, e) {
menuElem.menu('removeItem', menuElem.menu('findItem', e).target)
});
if ($('#' + item.id + '_separator').length === 1) {
menuElem.menu('removeItem', $('#' + item.id + '_separator')[0]);
}
It's complicated by the fact that I have to do this for several menus (I have a sequence of "Presets" dropdown buttons for various fields). It's just extra gross.