这就是我想要做的。
在第一行有 tds a = the text in the first cell
然后 b = the selected value of the drop down that the user selected
由于我的代码不起作用,我该怎么做?
$(document).ready(function () {
var s = $('table td:first').parents('tr');
var a = s.eq(0).text();
var b = s.eq(1).find('option:selected').val();
alert(a + " " + b);
});
<table>
<tbody>
<tr>
<th>ID</th>
</tr>
<tr>
<td>
test
</td>
<td>
<select>
<option value="yes">yes</option>
<option selected="selected" value="no">no</option>
</select>
</td>
</tr>
</tbody>
</table>