Привет, ребята, я пытаюсь изменить кнопку «Проверить все», чтобы проверить только те строки, которые видны. К сожалению, я не вижу, как я могу адресовать только видимые строки. Я пробовал что-то подобное, но у меня ничего не вышло.
$("#checkAll").click(function(){
if(!x){
if($(".check").is("visible")){
$(':checkbox').each(function(){ this.checked = true;
});}
x=true;}
else{
$(':checkbox').each(function(){ this.checked = false; });
x= false;
}});
Вот так я фильтрую свою таблицу.
function abtFilter() {
// Declare variables
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("searchbar");
filter = input.value.toUpperCase();
table = document.getElementById("notfallTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[3];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
$("")
}
}
}
}
и вот так выглядит таблица.
items.push("<td class='numbers' contenteditable>"+val.Nummer+"</td>");
items.push("<td contenteditable>"+val.Typ+"</td>");
items.push("<td contenteditable>"+val.Vorname+"</td>");
items.push("<td contenteditable>"+val.Nachname+"</td>");
items.push("<td contenteditable>"+val.Abteilung+"</td>");
items.push("<td class='check'><label><input type='checkbox'>"+""+"</input></label></td>");
items.push("</tr>");
Привет Эльфдов