Possible Duplicate:
How to remove a property from an object?
I am comparing two JSON objects and then deleting the old items from a list with this code:
dangerousPeople = ({1:{title:"Jackie Chan", user:"Jackie"}, 2:{title:"Chuck Norris", user:"Chuck"}, 3:{title:"Britney spears", user:"Britney"}});
newDangerousPeople = ({1:{title:"Jackie Chan", user:"Jackie"}, 3:{title:"Britney spears", user:"Britney"}});
$.each(dangerousPeople, function(index)
{
if(!newDangerousPeople[index]){
$('#dangerousPeople #id'+index).slideUp("normal", function() { $(this).remove(); } );
delete dangerousPeople.index;
}
});
The part of the script that slidesup the element works, but deleting the element from the object I can't make it work.
I tried with delete dangerousPeople.index
but doesn't work, also tried delete $(this)
but no luck either.
So how should I remove the element from itself?