I am having a little problem, I can not add data to an existing element, so here is my Html code ( 1 line ):
<div id="lista"></div>
And here is my script :
var text = "ok";
for(var i=0; i<3;i++){
text += "<p>text"+i+"</p>";
}
alert(text) // shows the expected data : ok<p>text0</p><p>text1</p><p>text2</p>
document.getElementById("lista").innerHTML = text;
But nothing is added to my page, And Rather than using innerHtml I used textContent, but it seems it is not working.
I followed a tutorial for begginers but as you can see, I dont get the expected results, any help would be much appreciated.