DSatishchandra commited on
Commit
7ea28c1
·
verified ·
1 Parent(s): 72a04a3

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +10 -6
templates/menu.html CHANGED
@@ -590,13 +590,17 @@ function updateCartDisplay(cart) {
590
 
591
  // Function to round reward points to a single digit
592
  function roundRewardPoints() {
593
- let rewardPointsElement = document.getElementById('reward-points');
594
- let rewardPoints = parseFloat(rewardPointsElement.innerText);
595
-
596
- if (!isNaN(rewardPoints)) {
597
- rewardPointsElement.innerText = rewardPoints.toFixed(1); // Rounds to 1 decimal place
598
- }
599
  }
 
 
 
 
600
  // Run the function when the page loads
601
  window.onload = roundRewardPoints;
602
 
 
590
 
591
  // Function to round reward points to a single digit
592
  function roundRewardPoints() {
593
+ let rewardPointsElement = document.getElementById('reward-points');
594
+
595
+ if (rewardPointsElement) {
596
+ let rewardPoints = parseFloat(rewardPointsElement.innerText);
597
+ if (!isNaN(rewardPoints)) {
598
+ rewardPointsElement.innerText = rewardPoints.toFixed(1); // Rounding to 1 decimal place
599
  }
600
+ } else {
601
+ console.error("Reward points element is missing.");
602
+ }
603
+ }
604
  // Run the function when the page loads
605
  window.onload = roundRewardPoints;
606