Is there a way to remove a specific element (e.g. by using its id) from a JSON array?
A delete button can be used to achieve this task, passing the id as a parameter.
For instance, how would one go about deleting an item with an id of 2 :
Note: The id number 2 could be located at index position 10 or 20 within the array.
"id": 2, "date": "27 Mar 2018", "name": "name 2", "type": "meeting"
var id = 1;
var events = [{
"id": id++,
"date": "26 Mar 2018",
"name": "name 1",
"type": "task"
},
{
"id": id++,
"date": "27 Mar 2018",
"name": "name 2",
"type": "meeting"
},
{
"id": id++,
"date": "27 Mar 2018",
"name": "name 3",
"type": "meeting"
}
];
events.push({
"id": id++,
"date": "25 Mar 2018",
"name": "name 4",
"type": "meeting"
});