I'm so sorry i don't really know how i can title this question but i believe with little explanation you guys will know what i wanted to achieve. below is my code
var brandObj = $.parseJSON(\$brand);
var listItems= "";
for (var i = 0; i < brandObj.length; i++){
listItems+= "<option value='" + brandObj[i].name+ "'>" + brandObj[i].name + "</option>";
}
$("#brand-select").append(listItems);
The json object has many attribute like brandObj[i].name, brandObj[i].id, brandObj[i].color,brandObj[i].size,
and so on, so now i need to check according to users input to know which attribute i will show up in dropdown menu,
i try to assign the attribute to a variable so i can dynamically change the variable but it's not working, i tried this
var brandObj = $.parseJSON(\$brand);
var listItems= "";
var value = name
for (var i = 0; i < brandObj.length; i++){
listItems+= "<option value='" + brandObj[i].+value+ "'>" + brandObj[i].+value + "</option>";
}
$("#brand-select").append(listItems);
i replace the name attribute with variable but not working any one to help me on this thanks