jquery - eq() working against its definition -
here code:
console.log($("div:eq(x)"))//[object object]
i dont understand why above code outputs object object ,even if supply y in place of x still works ,whatever supply still works. i'm beginner jquery, have made mistake or misunderstood?
that x undefined. eq accept anything, thought index accept.
i got trying accomplish this:
for (var = 0; < 5; i++) { $("<div>helow</div>").appendto(document.body); document.write("</br>"); setinterval(waka,5000); } function waka(){ (var = 0; < 5; i++) { $("div:eq(i)") //i want select each div } }
but each div
not getting selected @ all. assumed i
gets replaced numerical value.
if think of $(param) function param being parameter. if call function function can return - doesn't have tell parameter invalid. when jquery interprets "div:eq(x)" can't find & returns empty instance of itself. it's not quite simple enough started in right direction
Comments
Post a Comment