I want to print array by taking inputs from the users when the user click value 3 input box than 3 input box will display where he can put the value but when I try to submit the array but no element is printed and the printed value is element is not defined
var arr=[0];
function get_value()
{
var n=parseInt(document.getElementById("n").value);
var div=document.getElementById("add");
var add='';
for(var i=0;i<n;i++)
{
add=add+"<br>Enter "+(i+1)+" value : <input type='text' id='arr"+i+"' id='arr' name='mytext'><br>";
}
add=add+"<input type='button' onclick='arr_sub()' value='Submit Array'>";
div.innerHTML =add;
}
function arr_sub()
{
for(i=0;i<n;i++)
{
arr[i] = parseInt(document.getElementById("arr").value);
parseInt(document.getElementById("arr").value)="";
}
for(var y=0;y<arr.length;y++)
var e = "<hr/>";
{
e += "Element is "+arr[y]+"<br>";
}
document.getElementById("show").innerHTML = e;
}
<html>
<head>
</head>
<body>
Enter Array Size : <input type="text" name="num" id="n">
<input type="button" value="submit" onclick="get_value()">
<div id="add">
</div>
<div id="show"></div>
<script src="javascript.js" type="text/javascript"></script>
</body>
</html>
strong text
name='mytext[]'and to properly submit the values to the server you will need to wrap the form elements inside the form tag: developer.mozilla.org/en-US/docs/Web/HTML/Element/form= document.getElementById("arr").value-> where is thei??