Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
Mostrar cálculo matemático en un elemento HTML con Javascript

Obtuve el siguiente código que calcula un porcentaje y quiero mostrar el resultado correcto en un elemento html (p). Esto es lo que tengo pero no se muestra en absoluto:

Aquí está el código en mi sitio: https://btrpay.com/btrpay-landing-dev/

ingrese la descripción de la imagen aquí

 <script> var slider = document.getElementById("myRange"); var output = document.getElementById("demo"); output.innerHTML = slider.value; slider.oninput = function() { var slider = document.getElementById("myRange"); var savings = ( ( slider * 2.65 ) / 100 ) * 12; output.innerHTML = this.value; //document.getElementById("demo").value = savings; }

¿Por qué no se muestra y cómo puedo imprimir el resultado de la fórmula?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Debe configurar el innerHTML de la output para el resultado de ahorro:

output.innerHTML = savings;

Así es como cambiaría el fragmento de código:

 var slider = document.getElementById('myRange'); var output = document.getElementById('demo'); output.innerHTML = slider.value; // this will update the value based on slider slider.oninput = function () { var slider = document.getElementById('myRange'); var savings = ((slider * 2.65) / 100) * 12; output.innerHTML = savings; // this will update the value based on slider + calculation };
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!