When I push strings into an array and display the elements in a textarea, everything seems to work fine until I try to get the number of elements using IDarr.length - it always stays fixed at 2. Can someone help me identify the error in my code? Here is what I have:
The Script:
function UpdBttn(ct){
var array = document.getElementById('array').innerHTML;
var IDarr = [array];
IDarr.push(ct);
document.getElementById('array').innerHTML = IDarr;
alert(IDarr.length);
}
The Textarea for Receiving Input:
<textarea id="array"></textarea><br>
Input text (from a database loop) used to populate IDarr with onchange event:
<input Type="text" id="event<%=ct%>" value="<%=events(dates)%>" onchange="UpdBttn(this, '<%=ct%>')">