text: function compute() {
      var principal = document.getElementById("principal").value;
  
      // Validation
      if (principal <= 0) {
          alert("Enter a positive number");
          // focus
          document.getElementById("principal").focus();
          return;
      }
  
      var rate = document.getElementById("rate").value;
      var years = document.getElementById("years").value;
  
      // Calculate interest 
      var interest = principal * years * rate / 100;
      var amount = Number(interest) + Number(principal);
  
      // calculate year
      var year = new Date().getFullYear() + parseInt(years);
  
      // Set output text
      document.getElementById("result").innerHTML = `
      If you deposit <span>${principal}</span>, <br>
      at an interest rate of <span>${rate}%</span>. <br>
      You will receive an amount of <span>${amount}</span>, <br>
      in the year <span>${year}</span>
      `
  }
  
  // update on change
  function updateRate() {
      var rateval = document.getElementById("rate").value;
      document.getElementById("rate_val").innerText = rateval + '%';
  }
  