here in this code i have defined 2 arrays temp_Array and storage_Array. when i input data it gets written to temp. i want to compare each index of temp with each index of storage so that i get storage as a unique array. so it pushes the value from temp to storage if and only if it does not exists there.
<!doctype html>
<html>
<head>
<title>jQuery UI Dialog - Default functionality</title>
<style>
body {
font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif";
font-size: 62.5%;
}
</style>
<link rel="stylesheet" href="jquery-ui.css">
<script src="jquery-1.11.1.js"></script>
<script src="jquery-ui.js"></script>
<script>
$(document).ready(function() {
$('path') .dblclick(function(){
$(function() {
$( "#dialog" ).dialog();
});
});
$('.cat') .click(function(){
$(function(){
$('#dialog').dialog('close');
});
});
});
</script>
</head>
<body>
<svg width="80" height="32">
<path d="M10 15 l15 0 l2.5 -5 l5 10 l5 -10 l5 10 l5 -10 l5 10 l2.5 -5 l15 0" stroke="black" stroke-width="2px" stroke-linejoin="bevel" fill="none"></path>
</svg>
<div id="dialog" title="Basic dialog" style="display:none">
<form>
Component-ID: <input type="text" name="id1" id ='id1'><br>
Componentval: <input type="text" name="val1" id ='val1'><br>
<input class="cat" type="button" value="Submit" onclick="loop();">
<script>
var storage_Array =[];
var temp_Array =[];
function writedata(){
//console.log(document.getElementById("id1"));
temp_Array.push({'id': document.getElementById("id1").value, 'val': document.getElementById("val1").value});
//console.log(storage_Array);
}
for(var i=0;i < 5; i++){
writedata();
}
console.log(temp_Array);
console.log(storage_Array);
}
</script>
</form>
</div>
</body>