-1

every day add the value in the div with + 1 a type of counter ...

var i = 1;

$(".teste").each(function () {
   i = parseFloat(i) + parseFloat($(this).data("teste"));
});
$(".teste").html(i);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="teste" data-teste="2" id="teste">  </div>

1 Answers1

0

If you want to increment i by 1 every day you will need some kind of loop and check against the date to see if the day has changed.

var i = parseInt($(this).data("teste")) + 1;
var running = true;
var currentDate = new Date();

while (running == true)
{
   if (currentDate.toDateString() != (new Date()).toDateString())
   {
       i = parseInt(i) + parseInt($(this).data("teste"));
       $(".teste").html(i);
   }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="teste" data-teste="2" id="teste">  </div>
Nathelol
  • 577
  • 7
  • 25