我有一个包含一组字符串的JavaScript数组。我想用jQuery或JavaScript一行一行地在HTML div元素中显示它们。如何在jQuery .html()函数中打印javascript数组值?
我的代码是到现在为止:
var data = data;
for (i = 1; i <= data.length; i++) {
data[i] = data[i] + '<br />';
$(target).html('<a>'+data[i]+'</a>');
}
我的数据显示在这一刻,现在。
Labelling MachinesLabels - Plastic, Metal, Foil etcLabels FabricLaboratories - MedicalLaboratories - TestingLaboratory Equipment & SuppliesLaboratory Equipment Services & Calibration
我希望他们显示类似这样的链接(内标签):
Labelling Machines
Labels - Plastic, Metal, Foil etc
Labels Fabric
Laboratories - MedicalLaboratories - Testing
Laboratory Equipment & Supplies
Laboratory Equipment Services & Calibration
在此先感谢
您需要使用append方法检查我的答案。 –