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

100
Vistas
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 Respuestas
Responde la pregunta

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