My question is...How do I do to remove a specific entry?
You can write another method
removeDataToArray: function(id, videotype, videoId) {
var videoArray = JSON.parse(document.getElementById("videoLinksArray").innerHTML);
//filter out item that matches the id, videoType and videoId
videoArray = videoArray.filter( function(val){
return !( val.id == id && val.videoType == videoType && val.videoId == videoId );
});
document.getElementById("videoLinksArray").innerHTML = JSON.stringify( videoArray );
},
It would be more like: removeDataFromArray(id) and it would know the
unique id of the entry
Then the filter will change to
videoArray = videoArray.filter( function(val){
return val.id != id;
});
Edit
removeFromArray(2);
It would then remove all this: id:"2", videotype:"youtube",
videoId:"CtjuDJytD18"
removeDataToArray: function(id) {
var videoArray = JSON.parse(document.getElementById("videoLinksArray").innerHTML);
//filter out item that match the id
videoArray = videoArray.filter( function(val){
return val.id != String( id ) ;
});
document.getElementById("videoLinksArray").innerHTML = JSON.stringify( videoArray );
},