我定义了以下数据表。
问题 - 绘制数据表后,当我从 slider jquery 输入检索值时,我收到跨度和整个文本而不是值。如何仅检索 sliderinput 的值?
<table class="zebra" cellpadding ="0" cellspacing="0" border="0" id="subscriptionsTable" width="100%">
<thead>
<tr>
<th>
User
</th>
<th>
Name Full
</th>
<th>
Sub Frequency
</th>
<th>
Price
</th>
<th>
Rep
</th>
<th>
Sales
</th>
<th>
Points
</th>
<th>
Save
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
以下是屏幕上的值,
<td class="sorting_1">60728</td>
<td>Les</td>
<td>Y</td>
<td>799</td>
<td></td>
<td></td>
<td>
<span class="ui-spinner ui-widget ui-widget-content ui-corner-all">
<input id="pointSlider" class="ui-spinner-input" type="number" step="1" min="0" aria-valuemin="0" autocomplete="off" role="spinbutton" style="border-width: 1px; border-color: rgb(206, 206, 206);" aria-valuenow="4">
<a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only" tabindex="-1" role="button" aria-disabled="false">
<a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only" tabindex="-1" role="button" aria-disabled="false">
</span>
</td>
td>
<img class="save" width="20px" title="Save this record" src="https://localhost:8443/project/images/Green_Check.png">
</td>
当我选择任何行时,我可以使用以下 jQuery 选择捕获行元素。
$(this).closest('tr').find('td').eq(0).html();
如何选择第 6 个元素?我有一个 ID=pointSlider 的 slider jquery,但找不到该值。
感谢您的帮助,jQuery 新手。
最佳答案
此选择有效。输入环绕在表格单元格中包含的范围内。 $(this).closest('tr').find('#pointSlider').val();
关于javascript - 使用 jquery 查找数据表的表格单元格的内部值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25191737/