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

152
Views
How Do I Clear My DOM where the emoji is placed to make way for the new set of Array coming to the DOM

working on an emoji app where users can put in an emoji in an input and add to the end of my current emoji sitting in the DOM .

Once my emoji has been pushed into the array of the hardcoded emoji's, the current emoji on display is meant to be cleared to make way for rendering the new arrays in being sent over.

This is where I am stocked.

Here is my code

let emojiIcons = document.getElementById("emoji-disp-cont")
let emoji = ["๐Ÿ‘จ๐Ÿพโ€๐Ÿ’ป", " ๐Ÿ„", " ๐Ÿ’ฝ"]

function render() {
  for (let i = 0; i < emoji.length; i += 1) {
    emojiIcons.textContent += emoji[i]
  }
}
render()
let addfrbtn = document.getElementById("addfr-btn")
addfrbtn.addEventListener("click", function() {
  let inputbox = document.getElementById("input-box")
  if (inputbox.value) {
    emoji.push(inputbox.value)
    inputbox.value = ""
    emojiIcons.textContent = ""
    render()
    console.log(emoji)
  }
})
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!