【发布时间】:2012-01-03 04:18:19
【问题描述】:
我使用 AJAx 和 PHP 从数据库中动态生成了葡萄酒类型列表 这是函数
function wineTypeHandler(data){
var Type = data.Type;
var countType = data.countType;
for(var i = 0; i < countType; i++){
$("#selectType").append(
$("<input />").attr({
type: 'checkbox',
name: 'Type',
class: 'wineTypeCheck',
value: Type[i]
}), Type[i] + "<br />"
);
}
}
如您所见,我已将结果“附加”到 id 为 selectType 的某个 div,这一切工作正常,我唯一的问题是当我想根据从该列表中检查的内容更新另一个列表时,它没有回应任何事情!当我尝试这种方法和许多其他方法时
$(document).ready(function(){
$(':checkbox').click(function(){
alert('started');
// other code
return true;
});
});
它不会提醒任何东西!谁能帮我解决这个问题。
提前谢谢你。
【问题讨论】: