我想在tr中的第二個td(我的示例中的firstName)中獲取div中的文本。這是我試過的,但它給了我空。第二個td中的jQuery div文本
我嘗試了所有之下,但沒有一個是工作..這裏是完整的代碼(此表是彈出):
$(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>
你沒有關閉你的''標籤 – 2013-02-27 07:52:54
'$('td:last div','#'+ value).text();' – adeneo 2013-02-27 07:56:02
就像那樣^ short and sweet! – 2013-02-27 07:59:19