I making a call using $.getJSON which returns me list of object {name: '###', id :'##', ....}.
$.getJSON("... url ", function(objectList){
$.each(
objectList , function () {
var temp = $('<li>'+ name+ '</li>').data("element", {
id = this.id;
name = this.name;
}
$('#abc').append(temp);
}
//alert ("hi");
var selectList = $('#abc li'); //line 3
I want to loop through selectList and add css class based on some condition, but i am not able to select any li element, but if I uncomment the alert statement, I am able to select the list.
only clue I can get is, while selecting the list at line 3, the DOM is not populated with list.