javascript - while loop in jQuery -
i need use while loop, wonder if there syntax changes in jquery
in javascript
var text = ""; var = 0; while (i < 10) { text += "<br>the number " + i; i++; } document.getelementbyid("demo").innerhtml = text;
how can perform loop in jquery this?
there no difference between javascript , jquery in case of while loop
$(function () { var text = ""; var = 0; while (i < 10) { text += "<br>the number " + i; i++; } $("#demo").html(text); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="demo"></div>
Comments
Post a Comment