";
$("ol.sortable").append(html);
build_under_form(data, "#" + data[0]["value"] + "_" + randomnumber);
}
}
$(this)[0].reset();
});
/*
on save of individual li option - this will serialize the data to the html so when you
save the actual menu it will take this data and send it to the server
*/
$("ol.sortable").on("click", ".submit-form", function() {
var form_data;
form_data = $(this).closest("form");
$(this).closest("li").attr("data-data", form_data.serialize());
$(this).closest("li").find('> .dd-handle > .list-name-option').text(form_data.find('input[name=label]').val());
$(".update-menu").trigger("click");
});
/*
remove the option form the list. The form is not updated until you click the update function
at which point it serializes the data without the option in.
*/
$("#menu-sortable-fields").on("click", ".delete-option", function(e) {
var li;
e.preventDefault();
$(this).closest(".item-information").slideUp("slow");
li = $(this).closest("li").fadeOut("slow");
setTimeout((function(e) {
$(li).remove();
}), 1000);
});
});