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

201
Vistas
Using JQuery, how do I hide the button that is clicked?

I have thirty two buttons (for a game). After a button is clicked I would like to set the visibility to hidden after each one is clicked. In addition to setting the visibility to hidden I will be 'saving' the name of each button to a list. Any help would be greatly appreciated.

So far I have tried:

$(document).ready(function() {
    $('#b1, #b2, #b3, #b4, #b5, #b6, #b7, #b8, #b9,\
     #b10, #b11, #b12, #b13, #b14, #b15, #b16, #b17, #b18,\
      #b19, #b20, #b21, #b22, #b23, #b24, #b25, #b26, #b27,\
       #b28, #b29, #b30, #b31, #b32').on('click', function() {
        $(this).style.visibility='hidden';
    });
});

(Where I have each button a unique id)

and

$(document).ready(function() {
    $('type["button"]').on('click', function() {
        $(this).style.visibility='hidden';
    });
});
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

$('input[name=Button_ID]').click(
     function ()
     {
         $(this).hide();
     }
);
about 4 years ago · Juan Pablo Isaza Denunciar

0

Welcome to javascript! jQuery has a function call called hide which if you call the selector element for a button will hide that specific item clicked on!

$(document).ready(function() {
    $("button").on('click', function() {
        $(this).hide();
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div>
  <button>1</button>
  <button>2</button>
  <button>3</button>
  <button>4</button>
</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