Working efficiently, I've set up a system to collect data within a div by inserting hidden input boxes before submitting it to the server. Below is the JavaScript code I'm using:
function appendToDiv()
{
var mydiv=document.getElementById("somediv");
var mydata=document.getElementsByName("description")[0].value;
var myurl=document.getElementsByName("url")[0].value;
var data=mydata+myurl;
mydiv.innerHTML="<input type='hidden' name='sUrl[]' value='"+data+"'/>"
}
I have an onchange event in place that continuously calls the above function until I have gathered all necessary data to send to the server. However, only one input gets appended to the div. What could be causing this issue?