我必须在表格的单元格中显示内容。
表格如下:
<table id="innertable">
<thead>
<tr class="tablewrapperheader">
<th>Status</th>
<th>Date Requested</th>
<th>Date Time Range</th>
<th>Reason</th>
<th>Date Approved/Denied</th>
<th>Reason Denied</th>
<th>Approve/Deny</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td id="check" class="pending"><img src="../images/icons/36x36/exclamation.gif" alt="exclamation"/>
<span id="checkMsg">Pending</span></td>
<td>06/15/2012</td>
<td>06/21/2012</td>
<td>Medical Checkups</td>
<td class="dateApproveDenied"></td>
<td class="reasonDenied"></td>
<td><img src="../images/icons/128x128/approve.png" class="actionApprove" alt="exclamation" height="16" width="16"/> <img src="../images/icons/128x128/deny.png" class="actionDeny" alt="" height="16" width="16"/></td>
</tr>
用户将点击激活或拒绝,如果拒绝,他们必须给出拒绝的理由。我必须在我使用类名“dateApproveDenied”和“reasonDenied”的受人尊敬的td中显示拒绝日期和原因。我正在使用 Jquery 来实现这种效果,但无济于事。
这是我的jQuery
$(".actionDeny").click(function(){
var reason = prompt("Write reason for denial.",'');
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //js months 0-11
var yyyy = today.getFullYear();
if(dd<10){
dd='0'+dd
}
if(mm<10){
mm='0'+mm
}
var today = mm+'/'+dd+'/'+yyyy;
$(this).closest('td .dateApproveDenied').text(today);
$(this).closest('td .reasonDenied').text(reason);
});
我收到了写下原因的提示,但原因和日期没有出现在 td 中。请有人帮我把它设置好。谢谢