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

99
Views
How to add a filter search bar in JS

const sounds = [
  'Jason',
  'lil Jon',
  'mario',
  'TwoClock',
  'beep boppy',
  'Dixon Cider',
  'Baldy',
  'PK Fire',
  'look Eye',
  'Show up'
];

sounds.forEach((sound) => {
  const btn = document.createElement('button');
  btn.classList.add('btn'); // sound button formula
  btn.innerText = sound;
  btn.addEventListener('click', () => {
    // stopSongs();
    document.getElementById(sound).play();
  });

  document.getElementById('buttons').appendChild(btn);
});

//#19 stops sound from playing when you click on another button


//adding a filter for our search
<h1>Dr s</h1>
<h2>Sound board</h2>

<!--Filter-->

I tried looking up and could not find a way to add a filter search for buttons. I know it should be a function just struggling on how to set it up.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This might be your solution, you forgot to add }) to the end of one of your functions. Your code should work now!

const sounds=[
'Jason',
'lil Jon',
'mario',
'TwoClock',
'beep boppy',
'Dixon Cider',
'Baldy',
'PK Fire',
'look Eye',
'Show up'
];

sounds.forEach((sound) => {
  const btn = document.createElement('button');
  btn.classList.add('btn');
  btn.innerText = sound;

  btn.addEventListener('click', () =>{

    document.getElementById('buttons').appendChild(btn); 
    }); // <= You forgot this
});
<div id="buttons">

</div>

about 4 years ago · Juan Pablo Isaza 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!