【发布时间】:2016-12-08 14:28:08
【问题描述】:
我希望循环一个对象并使用 jQuery 输入某些索引。我正在使用 Sweet Alert 2 和链接模式,但我需要动态生成标题。标题在下面的数组中。
SA2使用的对象如下:
var steps = [{
title: 'Questions',
input: 'radio',
inputOptions: inputOptions,
}]
我猜方括号后面是某种“每个”。
["Washing Machine diagnosis", "Washing Machine type", "Have you ever had an engineer look at this fault?", "Has an engineer looked at this appliance in the last 6 months?", "Has anybody that is not a qualified repair engineer attempted to repair the Washing Machine?", "Duration of problem", "When did you purchase this Washing Machine?", "Do you have a receipt?"]
基本上我需要创建:
var steps = [{
title: 'Washing Machine diagnosis',
input: 'radio',
inputOptions: inputOptions,
},
{
title: 'Washing Machine diagnosis',
input: 'radio',
inputOptions: inputOptions,
}]
感谢您的帮助
【问题讨论】:
标签: javascript jquery arrays ajax loops