私はJQueryを初めて使用し、問題が発生しました。チェックボックスがあるテーブル行から特定のセル値を読み取りたい。チェックボックスがオンになっているイベントを処理するイベントがあります。これは私のコードです:
$("#businesses input:checkbox").change(function (
var $this = $(this);
if ($this.is(":checked")) {
//Here I want to read a value from a column in a row where is the checkbox
} else {
//Here I want to read a value from a column in a row where is the checkbox
}
});
「businesses」というテーブルがあり、この形式になっています
<table id="businesses">
<tr>
<th>Select Value</th>
<th>Value</th>
</tr>
<tr>
<td><input type="checkbox" class="selectedService" title="Seleccionar" /></td>
<td>125</td>
</tr>
<tr>
<td><input type="checkbox" class="selectedService" title="Seleccionar" /></td>
<td>126</td>
</tr>
</table>
私がやりたいのは、チェックボックスを選択すると、その行の値フィールドを取得することです。
最初のチェックボックスを押すと、125を取得したいと思います。
ありがとう!!!