for (var i = 0;i<Factories.length;i++){
$("#factorylist").append(
"<p style='width: 140px' id='factory"+[i]+"'>"+ Factories[i].name +"</p>"+
);
$("#factory"+[i]+"").bind("click", {index: i}, clickHandler);
}
function clickHandler(event) {
var i= event.data.index;
console.log(i)
}
jquery循环绑定事件
最新推荐文章于 2023-07-15 15:35:40 发布