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

213
Views
when i click a button second time my label want to dissappear

i have a button and label like this:

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

When i click this button second time that label want to hide/dissappear

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

0

You can use the onclick event of the button. Add JQuery and use the below code.

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

OR, in vanilla js you can use

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

SOLUTION

Use Inbuilt JS event

There is event in JS ondblclick event which fires only on double clicked check the snippet below

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

Code :

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!