Javascript - Efficiently Insert Multiple Html Elements
I'd like to create a select element with a list of a user's Facebook friends (obtained as a JSON object). I hardcode into my HTML, then
Solution 1:
Try this in your for loop instead:
var o = document.createElement('option');
o.setAttribute('value', response.data[i].id);
o.appendChild(document.createTextNode(response.data[i].name));
msgContainer.appendChild(o);
Post a Comment for "Javascript - Efficiently Insert Multiple Html Elements"