jQuery sibling selector?
- by Brett
Hi,
I have a table which I'm trying to do a pricing list, that auto-computes the tax component..
I'm getting the value from price_1, applying a math cal, and saving it to tax_1. I could read the number of the end of the id, but hopefully there is a cleaner way with jQuery.
E.g. I would have a lot of fields like..
price_1
price_2
price_3
tax_1
tax_2
tax_3 etc...
I can use the following code to call jQuery on change of a price, and get the value of that price. How do I update the tax field next to it? should I use a sibling selector or something??
$('#pricing').delegate("input", "change", function(){
$(this).val() /* the value of the price */;
})