Find class in table row
Posted
by meep
on Stack Overflow
See other posts from Stack Overflow
or by meep
Published on 2010-03-08T09:48:32Z
Indexed on
2010/03/08
9:51 UTC
Read the original article
Hit count: 176
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 :-)
© Stack Overflow or respective owner