jQuery sibling selector?
        Posted  
        
            by Brett
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Brett
        
        
        
        Published on 2010-05-04T05:13:28Z
        Indexed on 
            2010/05/04
            5:18 UTC
        
        
        Read the original article
        Hit count: 283
        
jQuery
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 */; 
})
        © Stack Overflow or respective owner