选择标签更改的多个参数不起作用

问题描述 投票:0回答:1

我将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()函数中抛出错误消息。

请帮忙 !!!

javascript jquery html javascript-events
1个回答
0
投票

用以下代码替换您的代码并尝试

  "<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>"
© www.soinside.com 2019 - 2024. All rights reserved.