Using a class name in jQuery's .closest()

后端 未结 4 501
长情又很酷
长情又很酷 2020-12-25 12:16

I\'m attempting to do some calculations for a \"running total\", this is my code:

$(\'.quantity_input\').live(\'change\',function(){         
                       


        
4条回答
  •  星月不相逢
    2020-12-25 12:52

    I wouldn't use .find(). I'm guessing it will probably be a bit more efficient to traverse up to the closest and get the sibling with the .cost_of_items class using jQuery's .siblings() method.

    $(this).closest('td').siblings('.cost_of_items');
    

    EDIT: To clarify, here's the markup from the .append():

    
         
        
        ' + omPartNo + '
        ' + supPartNo + '
        ' + cat + '
        ' + desc + '
        ' + manuf + '
        ' + list + '
        ' + disc + '
         
        
           

    Add/Edit

    ' + priceEach + '

    Add/Edit

提交回复
热议问题