Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 Respostas
Responde à pergunta

0

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

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda