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

232
Views
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 answers
Answer question

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 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!