Can someone kindly enlighten me why the following code of mine does not work?
for(var i=0; i<4; i++) {
var ref = i+1;
$("#test").append("<div id='t" + ref + "'>In t" + ref + "</div>");
}
My intention is to create child divs inside 'test' div. But when I check with '$("#test > div").size()', it returns '0'. I've also tried some other alternative including the one mentioned in 'Dynamically Generating Divs with jQuery based on variable number' post, but this also return the same result '0'.
I am using "jquery-1.6.4.js" (also tried with "jquery-1.6.2.js").
Hope someone can point out what am I doing wrong.