jquery attr("onclick",function()) 自动触发onclick事件生成行,导致死循环

luoshiyindfj luoshiyindfj 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

function createRowItem(rowId)
{
var rows=$("#tab_OrderDetail tr");
var rowLen=rows.length;
var rowN= rowId+1;
if(rowN==rowLen)
{
var tr=$("<tr>").append("<td>"+rowN+"</td><td><input type=\"text\" id=\"truckName_"+rowN+"\"/></td><td><input type=\"text\" id=\"truckCode_"+rowN+"\"/></td><td><select id=\"truckType_"+rowN+"\"><option >0</option></select></td><td><input type=\"text\" id=\"configuration_"+rowN+"\"/></td><td><input type=\"text\" id=\"price_"+rowN+"\"/></td><td><input type=\"text\" id=\"Amount_"+rowN+"\"/></td><td><input type=\"text\" id=\"totalMoney_"+rowN+"\"/></td><td><select id=\"consignType_"+rowN+"\"><option>0</option></select></td><td><input type=\"text\" id=\"consignTime_"+rowN+"\"/></td>");
tr.attr("id", (rowN));
$("#tab_OrderDetail").append(tr);
$("#consignTime_"+rowN+"").attr("onclick",createRowItem(rowN));
}else{ return;}
}

...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
luoshiyindfj
Ajax 52,778 成员 25,334 内容