I am setting an element in an array like this:
dialogs[id] = $.modal({
title: "Admin",
closeButton: true,
content: content,
width: false,
resizeOnLoad: true,
buttons: {
'Close': function (win) {
win.closeModal();
}
}
}).find('form') // Attach logic on forms
.submit(formSubmitHandler)
.end();
Later on I check if exists like this:
if (!dialogs[id]) {
loadAndShowDialog(id, link, url);
}
How can I remove the id record from the dialogs array? Is there something like a dialogs[id].Remove() ?
the command is : (set it to undefined)
if you want to completely remove : use
splice.edit
I mistakely thought that its is an object property which you want to remove ( delete will be fine here – and only solution)
howevert – you have an Array and the correct answer is to use
splice.