-1
I would like to make the following calculation: take the amount of value to pay,take the value of the days of delay and that when clicking the confirm button do the following calculation: value_a_pay*(delay*2)/100, I tried this but it did not work
html:
<div class="form-group">
  <label> Pagamento De Janeiro</label>
  <br>
  {% for s in students %}
  <span>Valor a pagar <strong id="pag_jan">{{s.fee}}</strong><div class="form-content"><form>
      <div class="input-group mb-3"> <label>Dias de atraso</label><input type="search" placeholder="" 
           name="atraso" id="atraso" value="0">
        <button class="btn btn-light" type="submit" onclick="calc()">confirmar</button></span>
  {%endfor%}
  {% render_field form.jan_pay class="form-control" %}
  
</div>
<script>
   var pag= document.getElementById("pag_jan")
   var result= pag.innerText
   var atraso = document.getElementById("atraso")
   var result_atraso = atraso.value
   function calc(e) {
      e.preventDefault();
        if(result_atraso <=0 ){
          return
     }else{
      var resultado =  result*(result_atraso*2)/100
      console.log(resultado)
    }
   }
     
</script>
but this code is already pure js
– Ricardo Pontual
but it doesn’t work
– Felipe Marlon
then you need to debug and find out what happens, look at the console and see if there are errors
– Ricardo Pontual