我想在 tr 中的第二个 td 中获取 div 中的文本(在我的示例中为 firstName)。这是我尝试过的,但它给了我空值。
我在下面尝试了所有但没有人在工作..这是完整的代码(此表在弹出窗口中):
$(document).ready(function() {
$('#listings_row_landlord').dataTable();
});
这个警报代码:
var first_name = $('#'+value).find("td:eq(1) div").html();
<table width="100%" cellspacing="0" cellpadding="0" align="center" style=" border-radius:0px;" id="listings_row_landlord" class="display">
<thead bgcolor="#E5E5E5" align="left" style="font-size:12px;" class="listing_headings">
<tr><th width="20" style="text-align:center; width:20px;" class="sorting_desc" rowspan="1" colspan="1"></th><th class="sorting" rowspan="1" colspan="1" style="width: 94px;">First Name</th><th class="sorting" rowspan="1" colspan="1" style="width: 92px;">Last Name</th><th class="sorting" rowspan="1" colspan="1" style="width: 86px;">Mobile No</th><th class="sorting" rowspan="1" colspan="1" style="width: 83px;">Phone No</th><th class="sorting" rowspan="1" colspan="1" style="width: 50px;">Email</th><th class="sorting" rowspan="1" colspan="1" style="width: 95px;">Created By</th><th class="sorting" rowspan="1" colspan="1" style="width: 108px;">Assigned To</th><th class="sorting" rowspan="1" colspan="1" style="width: 59px;">Listed</th></tr></thead>
<tbody>
<?php
while ( $rw = $oAppl->row($rs) ) {
?>
<tr id="<?php echo $rw["id"]; ?>" class="listing_rows odd"><td class=" sorting_1"><div id="item_action" style="text-align:center; width:22px;"><input type="radio" value="<?php echo $rw["id"]; ?>" id="checkbox_<?php echo $rw["id"]; ?>" name="select_landlord"></div></td>
<td>
<div style="width:100px;"><?php echo $rw["fname"]; ?> </div></td>
<td><div style="width:100px;"><?php echo $rw["lname"]; ?></div></td><td><div style="width:160px;"><?php echo $rw["mobile"]; ?></div></td><td><div style="width:150px;"><?php echo $rw["phone"]; ?></div></td><td><div style="width:180px;"><?php echo $rw["email"]; ?></div></td><td><div style="width:100px;">Admin Admin</div></td><td><div style="width:100px;">Admin Admin</div></td><td><div style="width:80px;"><?php echo $rw["created_date"]; ?></div></td></tr>
<?php
}
?>
</tbody></table>