Using variable in place of class or id name in jQuery

Last Reply 8 months ago By pandeyism

Posted 8 months ago

how can i use variable in place of class or id name in jquery

var ddlclass = $("#ddlclass" + TrainNumber+"");
for (var j = 0; j < train.length; j++) {
var cls = $("<option value='" + j + "'>" + train[j].ClassCode + "</option>");
    $(ddclass).append(cls); //trying this but unable to append please help
}

 

This question does not have replies that have been liked.