diff --git a/assets/javascripts/contracts.js b/assets/javascripts/contracts.js index 5bf7afd..27b87ac 100644 --- a/assets/javascripts/contracts.js +++ b/assets/javascripts/contracts.js @@ -80,12 +80,14 @@ jQuery(function($) { addNewDeliverableFinance = function(financeType) { var t = $('#labor-budget-template').tmpl({}); - var countOfExisting = $("tr.labor-budget-form").size(); - var recordLocation = countOfExisting + 1; // increments the Rails [n] placeholder - var newContent = t.html().replace(/\[0\]/g, "[" + recordLocation + "]"); + if (t.length > 0) { + var countOfExisting = $("tr.labor-budget-form").size(); + var recordLocation = countOfExisting + 1; // increments the Rails [n] placeholder + var newContent = t.html().replace(/\[0\]/g, "[" + recordLocation + "]"); - $("