我动态创建了一个表单,我在表单中创建了一个按钮,但是表单的onclick属性不起作用.Below是我的javascript代码
for (var i = 0; i < res.length; i++) {
var form = $('<form></form>');
form.attr({"id": "form"+i});
var i1=$('<input></input>');
i1.attr({
"type" :"hidden",
"id" :"aid",
"value":res[i].s_id
});
var i4=$('<h3></h3>');
i4.text('ID:'+res[i].s_id+':'+res[i].s_name);
var i5=$('<input></input>');
i5.attr({
"type" :"radio",
"name" :"status",
"value":"P"
});
var i6=$('<input></input>');
i6.attr({
"type" :"radio",
"name" :"status",
"value":"A"
});
var i7=$('<input></input>');
i7.attr({
"type" :"button",
"value" :"submit",
"onclick":"makeAtten()"
});
form.append(i1);
form.append(i4);
form.append(i5);
form.append(i6);
form.append(i7);
$('#sheet').append(form);
}