最佳答案
我有选择标签的 数组。
<select id='uniqueID' name="status">
<option value="1">Present</option>
<option value="2">Absent</option>
</select>
我想创建一个 json 对象,在 JavaScript 中有两个字段‘ uniqueIDofSelect 和 optionValue’。
我使用 getElementsByName (“ status”)并对其进行迭代。
剪辑
我需要像
[{"selectID":2,"OptionValue":"2"},
{"selectID":4,"optionvalue":"1"}]
诸如此类。