Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

234
Vistas
When trying to set an HTML element's content to an Emoji in javascript, it displays strange symbols

I want to have a javascript function that changes the text of an element with the id "emoji" to the laughing emoji.

function changeEmoji() {
    document.getElementById("emoji").textContent = "🤣"
}

but when I use this code the element displays 🤣 instead.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

you can add emoji by using their unicode id http://unicode.org/emoji/charts/full-emoji-list.html#1f600

for smiley laungting it's code 0x1F923

var emoji = String.fromCodePoint(0x1F923)

Be careful, String.fromCodePoint() is part of the ES2015 standard.so you can have issue on some old browsers

var emoji = String.fromCodePoint(0x1F923)
document.getElementById("emoji").textContent = emoji;
<div id="emoji">
</div>

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda