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

158
Views
Javascript para insertar íconos emoji en el área de texto cuando el clic no funciona

Quiero hacer un script para insertar emojis en el área de texto al hacer clic. Pero nunca funciona.

¿Alguien puede señalarme dónde estoy haciendo mal?

Gracias.

 <form> <button value="😀">😀</button> <button value="😂">😂</button> <button value="👍">👍</button> <br> <textarea id="text1" cols="40" rows="3" placeholder="This is some dummy text."></textarea> </form> <script type="text/javascript "> let currentInput = document.getElementById('text1'); function insertAtCursor() { let cursorPos = currentInput.selectionStart; let v = currentInput.value; let textBefore = v.substring(0, cursorPos); let textAfter = v.substring(cursorPos, v.length); currentInput.value = textBefore + this.value + textAfter; cursorPos += this.value.length; currentInput.focus(); currentInput.setSelectionRange(cursorPos, cursorPos); }; if (document.querySelector('button')) { document.querySelectorAll('button').forEach((elem, i) => { elem.addEventListener("click", function(event) { insertAtCursor(); }); }); } </script>
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!