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

210
Views
cuando hago clic en un botón por segunda vez, mi etiqueta quiere desaparecer

Tengo un botón y una etiqueta como esta:

 <button id="btn">Button</button> <label id="lbl">lbl</label>

Cuando hago clic en este botón por segunda vez, esa etiqueta quiere ocultarse/desaparecer

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

0

Puede utilizar el evento onclick del botón. Agregue JQuery y use el siguiente código.

 var cnt = 0; $('#btn').on('click', function() { cnt++; if(cnt == 2) $('#lbl').hide(); })

O, en vanilla js puedes usar

 var cnt = 0; document.getElementById('btn').onclick = function() { cnt++; if(cnt == 2) document.getElementById('lbl').style.display = 'none'; };
about 4 years ago · Juan Pablo Isaza Report

0

SOLUCIÓN

Usar evento JS incorporado

Hay un evento en el evento JS ondblclick que se activa solo al hacer doble clic, verifique el fragmento a continuación

 function hide() { document.querySelector("label").style.display= "none"; }
 <button ondblclick="hide()" id="btn">Button</button> <label id="lbl">Hide me after Double clicking on button</label>

about 4 years ago · Juan Pablo Isaza Report

0

Código:

 button = document.getElementById("btn") label = document.getElementById("lbl") button.addEventListener('dblclick', function(){ label.style.display = 'none'; })
 <button id="btn">Button</button> <label id="lbl">lbl</label>

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!