我将id作为select标签的onchange属性中的第二个参数传递给
for (var counterOfLoop in data)
{
var id = data[counterOfLoop]['_id']['$oid'];
....
"<td class='col-sm-2'>"+
'<select id="route_'+ id+'" name="route'+id+'" type="text" class="form-control validate-required" onchange="fetchAllStops(this.value,"'+id+'"")"> </select>'+
"</td>"+
}
当我从select标签中选择任何内容时,它会在fetchAllStops()函数中抛出错误消息。
请帮忙 !!!
用以下代码替换您的代码并尝试
"<td class='col-sm-2'>" + '<select id="route_' + id + '" name="route' + id + '" type="text" class="form-control validate-required" onchange="fetchAllStops("'+this.value+'","' + id + '"")"> </select>' + "</td>"