In my project I'm trying to create, with DOM and JavaScript, a loop to create multiple elements, like this example:
for (i = 0; i < response.click.length; i++)
{
var divClick = createElement('div', 'divClick', 'divClk');
divClick.setAttribute('style','top: '+response.click[i].ypos+';');
divClick.setAttribute('style','left: '+response.click[i].xpos+';');
divLogin.appendChild(divClick);
}
In practice I need to append at one main div a series of divs (little blue square - divClick) positioned using value parsing from ypos and xpos, but with this code the result is just one square positioned at 0,0 coordinates.