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
Post a Comment