HTML
Код: Выделить всё
Filterable Table
Type something in the input field to search the table for first names, last names or emails:
Firstname
Lastname
Email
John
Doe
john@example.com
Mary
Moe
mary@mail.com
July
Dooley
july@greatstuff.com
Anja
Ravendale
a_r@test.com
Note that we start the search in tbody, to prevent filtering the table headers.
Код: Выделить всё
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
Код: Выделить всё
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
Подробнее здесь: https://stackoverflow.com/questions/585 ... body-using
Мобильная версия