I want to append li five times in body using each function. But it is not working. It should append five li in body Note: It is just a sample code
$(function(){
var lgt= 5;
$.each(lgt,function(i){
$('body').append('<li>'+i+'</li>')
})
})
<li>can't be the child of<body>. You need either<ul>or<ol>.