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

131
Views
Javascript Filter Table then select all checkboxes

I have an html table with a checkbox on each row. My javascrpt filters rows based on a text box above the table. I need a function that will only check the boxes on visible rows. I'm stumped.

chkbuild is the name of all the checkboxes in the table. ID is unique. chkallnone is my header checkbox to select all or none.

example of table row cell

<td><input type="checkbox" id="(counter)" name="chkbuild" value="(unique ids)"></td>

Javascript code for selecting checkboxes.

  function checkCheckboxes( id, pID ){
var ele=document.getElementsByName('chkbuild');  
var TrueFalse = true;
//determine if the select all checkbox is checked or unchecked.
if (document.getElementById('chkallnone').checked) {
    TrueFalse = true;
} else {
    TrueFalse = false;
}
//cycle through all table checkboxes and set their checked value
for(var i=0; i<ele.length; i++){  
    ele[i].checked=TrueFalse;  
}

}

Comments added 08/23/2022 My table row has <tr data-link="filename.php" data-target="_SELF"> and the javascript has this function which live filters the table.

$("table tr").click(function(e) {
var u = $(this).data("link");
var t = $(this).data("target");
console.log(u, t);
if (t.length) {
  window.open(u, t);
} else {
  window.location.href = u;
}
});
about 4 years ago · Juan Pablo Isaza
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!