私はループしているテーブルを持っていて、各行の列から値を取得したいと考えています。それ、どうやったら出来るの?テーブル行をループしながら値を引き出す方法は?
$('#buildingList tr').each(function() {
//check each column in the row and get value from column 3 which is a drop down
});
<table id="buildingList">
<tr>
<td class="ms-vb2"/>
<td class="ms-vb2"/>
<td class="ms-vb2">
<select id="ddl">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</td>
</tr>
<tr>
<td class="ms-vb2"/>
<td class="ms-vb2"/>
<td class="ms-vb2">
<select id="ddl">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</td>
</tr>
<tr>
<td class="ms-vb2"/>
<td class="ms-vb2"/>
<td class="ms-vb2">
<select id="ddl">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</td>
</tr>
</table>
をすべて選択の要素は同じID(DDL)を持っています。それは無効です;) –
あなたの選択はすべて同じid属性を持つことに注意してください。 id属性は、各要素に対して一意である必要があります。たぶんあなたの意図は、各クラス= "ddl"を呼び出すことです? –