So, I am reading some data with document.getElementById which is already an array.But somehow when I am reading it, it is resulting in a string insted.
I am using the document.getElementById('clients').value, and apparently this returns a string, while I would like to get an array instead.
var clients = [];
clients = document.getElementById("clients").value;
alert(clients);
console.log(clients);
for(var i =0; i < clients.length; i++){
var client = clients[i].toString().split(',');
alert(client);
}
//console.log(clients) gets:
["[['1'", " 'client1']", " ['2'", " 'client2']", " ['3'", " 'client3']]"]
when I am alerting the client from the for loop, I am getting each and every character found in clients one by one. While I would like to get an object to split it. Thanks a lot in advance.