<div id="patchmanageTrainee" ><table><tr id="ajaxappend"><th>#springMessage("employeeCode")</th><th>#springMessage("employeeName")</th><th>#springMessage("sub-menu-training-attanding-absentreason")</th> </tr>
</table>這是是表頭
</div>
jQuery.ajax({
type:'post',
dataType:'json',
url:'ajax_searchabsent.htm',
data:'employeeId=' +wid[i]+'&sessionId='+$('#sessionId').val(),
success: function(msg){
for(var i=0;i<msg.length;i++){
var employeecode=msg[i].EMPLOYEE_CODE;
var reason=msg[i].ABSENT_REASON;
var name=msg[i].NAME;
var sessionId=msg[i].SESSION_ID;
alert(reason);
if(reason==undefined){
$("#patchmanageTrainee").find("tr").append('<tr><td>'+employeecode+'</td><td>'
+name+'</td><td>'+'<input maxlength=\"100\" class="textItem" placeholder=\"Please enter a reason\" />'+'</td></tr>');
}else{
$("#patchmanageTrainee").find("tr").append('<tr><td>'+employeecode+'</td><td>'
+name+'</td><td>'+'<input class="textItem1" value='+reason+' maxlength=\"100\" />'+'</td></tr>');
}
}
這是追加上去的數據,但是格式怎麼會是那樣???怎麼回事?
$("#patchmanageTrainee").find("tr")改為$("#patchmanageTrainee").find("table")
tr中不能插入tr。。