jQuery set value on specific table cell

Sam Deering
Tweet

Helper JS function which sets the price on a specified table cell based on the table id, row id and column number.

function setRowPrice(tableId, rowId, colNum, newValue)
{
    $('#'+table).find('tr#'+rowId).find('td:eq(colNum)').html(newValue);
};

Get your free chapter of Level Up Your Web Apps with Go

Get a free chapter of Level Up Your Web Apps with Go, plus updates and exclusive offers from SitePoint.

No Reader comments