У меня есть следующая таблица:Получить значение из элементов из таблицы
<table id="table_id">
<tr>
<td>Test</td>
<td>Description</td>
<td>Date</td>
</tr>
<tr>
<td><select>
<option val="1">Math</option>
<option val="2">Chemistry</option>
<option val="3">Biology</option>
</select></td>
<td><input type="text" id="txt_desc"/></td>
<td><input type="text" id="date"/></td>
</tr>
</table>
И следующий яваскрипта код для получения значений
val_test_op = '';
parent.$('#table_id option:selected').each(function (index,value){
test = $.text(value).trim();
if (index === 0 && test || index % 1 === 0 && test) {
val_test_op += index +' TEST: ' + test;
return;
}
})
val_test_input = '';
parent.$('#table_id td>input').each(function (index,value){
test = this.value;
if (index === 0 && test || index % 2 === 0 && test) {
texto_examen_input += index +' Description: ' + test;
return;
}
if (index === 1 && test || index % 3 === 0 && test) {
texto_examen_input += index +' Date: ' + test;
return;
}
})
Мой вопрос: ¿Как я могу получить значение из option: выбрано и вводит текст только в «каждой функции»?
Прикрепите его в форме и выполните '$ (form) .serialize()' – adeneo