我使用数据库中的数据填充表。表行有一个单选按钮。使用jquery如何检查行中的哪个无线电被检查?那么如何读取该行的列值?
这是表格人口代码。
<table id="wo_table" class="table table-striped responsive-utilities table-hover jambo_table">
<thead>
<tr class="headings">
<th>
<input type="checkbox" id="selectOne" class="flat">
</th>
<th class="column-title">WO Id </th>
<th class="column-title">Create Date </th>
<th class="column-title">Buyer </th>
<th class="column-title">Style </th>
<th class="column-title">Quantity </th>
<th class="column-title">GG </th>
<th class="column-title">Status </th>
<th class="column-title">Remarks </th>
</tr>
</thead>
<tbody>
<?php
$queryString="SELECT * FROM win_work_order";
fetchWOList($queryString);
function fetchWOList($queryString){
include 'ConnectionToDatabase.php';
$result=mysql_query($queryString);
while($test = mysql_fetch_array($result))
{
echo
'<tr class="even pointer">
<td class="a-center ">
<input type="radio" class="flat" name="table_records" value=' .$test['WO_ID']. '></td>
<td class=" ">' .$test['WO_ID']. '</td>
<td class=" ">' .$test['WO_CREATE_DATE']. '</td>
<td class=" ">' .$test['BUYER_NAME']. '</td>
<td class=" ">' .$test['STYLE_NAME']. '</td>
<td class=" ">' .$test['WO_QTY']. '</td>
<td class=" ">' .$test['CURRENCY_QTY_GG']. '</td>
<td class=" ">' .$test['WO_STATUS']. '</td>
<td class=" ">' .$test['WO_REMARKS']. '</td>';
echo "</tr>";
}
mysql_close($conn);
}
?>
</tbody>
</table>
答案 0 :(得分:0)
$('#wo_table input:radio:checked').val()
会为您提供ID,如果没有选中,则为undefined
。不要从HTML中读取数据,使用您获得的ID,验证其格式,然后获取具有该ID的行以对其数据执行某些操作。