I made a table where each row has a select and a refresh button. The problem is that when I click on the refresh of a particular row I want to update only that row and therefore I need to receive by jQuery only the number that is in the select of that row. The way I did it I get the numbers that are in the select of all the rows.
HTML:
<table border="0">
<tr>
<td class="td">
Número
</td>
</tr>
<?
for($i = 0; $i < 10; $i++){
?>
<tr class="tr">
<td class="td">
<select id="num">
<?php
for($k = 1; $k < 5; $k++){
echo "<option> $k </option>";
}
?>
</select>
</td>
<td class="td">
<form id="formulario" action="javascript:func()" method="post">
<input type="submit" value="Atualizar" />
</form>
</td>
</tr>
<?
}
?>
</table>
jQuery:
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$("form").submit(function(){
var num = $("#num option:selected").text();
alert(num);
});
});
</script>
Iwouldliketoseeonly1or4or3...dependingonwhichlinethe"Update" line is.