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

224
Views
How can i get the text value from a HTML number input field and not the transformed number value?

I need the text value of an input type="number" field because I need to scale other elements depending on its size.

const numberInput = document.getElementById('numberInput');
const outputSpan = document.getElementById('output');

numberInput.addEventListener('input', (inputEvent) => {
 outputSpan.innerText = inputEvent.target.value;
});

Does not work for inputs like ["e", "-", "+", "+132", "123e123123"] I know that in the background the input is transformed into the corresponding number but i need the original string for my resizing/positioning.

For clearity a link to a Stackblitz example:

  • vanillaJs: https://stackblitz.com/edit/js-fcjh2f?file=index.js
  • angular: https://stackblitz.com/edit/angular-ivy-duc89z?file=src/app/app.component.ts

For any help i would be grateful.

[Edit] Updated the angular example, so now it should be clear what the problem is.

about 4 years ago · Juan Pablo Isaza
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!