• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

109
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)
  }
})
almost 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
ยฉ 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error