using replace on val()

using replace on val()

This bit of code works great, removing the commas from numbers to do math.

  1. for(i=1; i<$('.coa_table tr').length; i++){
        var c_trs=parseInt($('.coa_table tr:eq('+i+')').find('td:last').text().replace(',', ''));
        c_count+=c_trs;
       }

I cannot figure out why I cannot do the same with .val() as the above .text(). This code errors with "Object doesn't support property or method 'replace'" on valhold.replace(',', ''). The code is retrieving the value from multiple input type="text" fields with a class="c_cell".

  1. $(this).prevAll().each(function () {
         var valhold = parseInt($(this).children('.c_cell').val());
         valhold = valhold.replace(',', '');
         totalVal += valhold || 0;
        });