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

115
Views
cómo hacer un espacio con appendChild (document.createTextNode)

Hola, ¿cómo podría hacer para tener un espacio después de mostrar un número?

me parece que vi en stackoverflow que era necesario insertar "'\u00A0'" pero no se donde insertarlo en mi codigo o tal vez me equivoque.

 document.getElementById("buttonTry").onclick = takeNumber; function takeNumber() { let x = document.getElementById("myNumber").value; document.getElementById("list").appendChild(document.createTextNode(x)); }
 .list__number { width: 200px; height: 300px; border-radius: 15px; border: thin solid #ccc; } #list { font-size: 20px; margin: 10px; line-height: 1em; color: red; white-space:normal; }
 <body> Number: <input type="number" id="myNumber" value="0"> <p>Click the button to display the number of the number field.</p> <button id="buttonTry">Try it</button> <section class="list__number"> <p id="list"></p> </section> </body>

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

0

Puedes literalmente insertar un espacio después de tu número:

 document.createTextNode(`${x} `); 

 document.getElementById("buttonTry").onclick = takeNumber; function takeNumber() { let x = document.getElementById("myNumber").value; document.getElementById("list").appendChild(document.createTextNode(`${x} `)); }
 .list__number { width: 200px; height: 300px; border-radius: 15px; border: thin solid #ccc; } #list { font-size: 20px; margin: 10px; line-height: 1em; color: red; white-space:normal; }
 <body> Number: <input type="number" id="myNumber" value="0"> <p>Click the button to display the number of the number field.</p> <button id="buttonTry">Try it</button> <section class="list__number"> <p id="list"></p> </section> </body>

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!