javascript - JQuery loop to append text not appending -


i try create loop jquery 2.1.0 appends paragraph each loop. code far

for (var = 0; < 3; i++) {    var hobby = prompt("tell me 1 of hobbies!");    $("body").append("<p>" + hobby + "</p>");  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

so prompt comes , works fine doesn't append... , doesn't loop. appreciated.

try use native js.

for (var = 0; < 3; i++) {  	var hobby = prompt("tell me 1 of hobbies!");  	var p = document.createelement('p');  	p.innerhtml = hobby;  	document.body.appendchild(p);  }


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -