【发布时间】:2014-01-27 08:02:54
【问题描述】:
我有一个jquery-ajax 函数,它创建了一个复选框列表。
success: function(msg){
jQuery.each(msg.gal_sublocations, function(index, gal_sublocation) {
html += '<input type="checkbox" name="data[GalStore][gal_sublocation_id][]" value = "'+gal_sublocation.GalSublocation.id+'" class="chkbx" id="sublocation_'+gal_sublocation.GalSublocation.id+'" />'+gal_sublocation.GalSublocation.name;
$('#load_sublocations').html(html);
alert(html);
$('#sublocation_'+gal_sublocation.GalSublocation.id).click(function(){
alert('Checked !');
});
});
}
alert(html) 产生最终警报
<input type="checkbox" name="data[GalStore][gal_sublocation_id][]" value = "99" class="chkbx" id="sublocation_99" />Beltola
<input type="checkbox" name="data[GalStore][gal_sublocation_id][]" value = "101" class="chkbx" id="sublocation_101" />Dispur
<input type="checkbox" name="data[GalStore][gal_sublocation_id][]" value = "102" class="chkbx" id="sublocation_102" />Paltan Bazar
<input type="checkbox" name="data[GalStore][gal_sublocation_id][]" value = "100" class="chkbx" id="sublocation_100" />Patarkuchi
但是当我点击复选框时,它没有提醒任何东西!怎么了?
【问题讨论】:
标签: jquery json checkbox cakephp-1.3