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

147
Views
Check status of checkbox using JavaScript

I want to create a function to see if a checkbox is checked or not and if so, run updateDocs().

I created the below but const isChecked = document.querySelector('#isPaperless'); does not seem to be correct. How is this done?

isChecked() {
  const isChecked = document.querySelector('#isPless');

  if (isChecked) {
    this.edocsService.updateEdocsStatus();
  }
}
<label htmlFor="isPless">
    <input id="isPless" name="isPless" type="checkbox" /> I want to receive my policy documents 
</label>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const input = document.getElementById('isPless');

function isChecked() {

    console.log("status : " + this.checked)

    if (this.checked) {
        
        this.edocsService.updateEdocsStatus();
    }
}

input.addEventListener("click", isChecked); 
<label htmlFor="isPless">
    <input id="isPless" name="isPless" type="checkbox" /> I want to receive my policy documents 
</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!