Find class in table row
- by meep
Hello.
Take a look at this table:
<table cellpadding="0" cellspacing="0" class="order_form">
<tr>
<th>Amount</th>
<th>Desc</th>
<th>Price</th>
<th>Total</th>
</tr>
<tr>
<td><input type="text" class="order_count" /></td>
<td>
<span class="order_desc">Middagstallerken</span>
</td>
<td>
<span class="order_price">1,15</span>
</td>
<td>
<span class="order_each_total"></span>
</td>
</tr>
[...]
</table>
Upon entering amount I need to select the class "order_price" and multiply it with the value of the input "order_count" and place it in "order_each_count". I have millions of these rows so I need to find the next class in the row.
I have tried using some function like this but without result:
<script type="text/javascript">
$(document).ready(function(){
$('.order_count').keyup(function() {
var each_price = $(this).prevUntil("tr").find("span.order_price").text();
});
});
</script>
I hope someone have a good solution :-)