我想将onclick事件添加到使用如下因素代码生成一个div:jQuery:如何将onlick事件添加到动态生成的div?
$("<div />").attr("city", $(this).attr("city"))
.attr("state", $(this).attr("state"))
.html($(this).attr("city") + ',' + $(this).attr("state"))
.appendTo($('#cityList'));
我应该写在HTML点击数事件()?
为什么不.bind(),它直接.appendto后()? – mddw