I have an array that is stored in a key, value format:
Code:
{id: 0, data: some data}
I have a list that corresponds to that id for deletion of a file and removal of an element. When using javascript splice to delete an object from the array it changes the index values.

Here is some of the code that I am currently working with to give you an idea of what I am trying to achieve.

Code:
function setupFileList(file,id){
	var filelist = document.getElementById("filelist");
	var fileName = file.name;
	var fileSize = 0;
	var reader = new FileReader();
	reader.onload = function(e){
		var imgsrc = e.target.result;
		if(file){
			if(file.size > 1024 * 1024)
				fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100).toString() + "MB";
			else
				fileSize = (Math.round(file.size * 100 / 1024) / 100).toString() + 'KB';
		}
		
		filelist.innerHTML += '<div id="file-'+id+'" class="upFiles"><img class="upImg" src="' + imgsrc +'" width="50px" height="50px"><div class="upProgress"><span>' + fileName + ' / ' + fileSize +'</span></div><a href="#" onclick="upDelete(\''+id+'\')">Delete</a></div>';
	};
	reader.readAsDataURL(file);
};
Code:
function upDelete(fid){
	//var element = document.getElementById("file-"+fid);
	//element.parentNode.removeChild(element);
	var fq = fileQuery.indexOf({id: fid});
	fileQuery.splice(fq, 1);
	console.log(fq);
	//console.log(fileQuery);
}