updateTotal() function not defined, however, i have the function defined inside of $(document).ready( function () { and have called updateTotal() inside of other methods where it needs to be used. Running total not updating. console is showing an updateTotal() not defined. Why could i be getting this error?
$(document).ready( function () {
 $('#plan').on('change', function() {
   var priceText;
   switch(this.value) {
     case 'monthly':
      priceText = '10.00 /mo';
      break;
     case 'quarterly':
      priceText = '$9.00 /mo';
      break;
     case 'yearly':
      priceText = '7.00 /mo';
      break;
   }
   $('#price').text(priceText)
  });
 function updateTotal() {
  var total = 0;
  var entries = $('.entry')
  if (entries.length)
    $('#empty').show();
  else
    $('#empty').hide();
  $('.entry').each( function(index, entry) {
    var data = $(entry).data();
    var price = parseFloat(data.price)
    var installment = data.plan
    switch(installment) {
      case 'monthly':
        total += price;
        break;
      case 'quarterly':
        total += price * 4;
        break;
      case 'yearly':
        total += price * 12;
        break;
    }
  })
  $('#total').text('$' + total);
}
});
$('#add').on('click', function() {
  var plan = $('#plan')
  var installment = plan.val();
  var price = $('#price').text();
  var inCart = $('#in_cart');
  var numeric = price.replace(/[[A-Za-z$\/\s]/g, '');
  var data = 'data-price="' + numeric + '" data-plan="' + 
  installment + '"';
  inCart.append('<li>' + installment + ' - ' + price + '<button 
 class="remove">X</button></li>')
  updateTotal();
});
  $(document).on('click', '.remove', function() {
  $(this).parents('li').remove();
  $('#empty').on('click', function() {
    $('#in_cart').empty();
    updateTotal();
  });
});
 
    