Home >Web Front-end >JS Tutorial >JQuery table operation (interlaced coloring, highlighting, filtering data)_jquery

JQuery table operation (interlaced coloring, highlighting, filtering data)_jquery

WBOY
WBOYOriginal
2016-05-16 17:55:561118browse

I checked some information and wrote 4 demos:

1. Interlaced coloring

Copy code The code is as follows:

$('#table1 tr:odd').addClass('odd');
$('#table1 tr:even').addClass('even');

Effect:

2. Highlight the rows containing specific data

Copy the code The code is as follows:

$("#table2 tr:contains('Fuck')").addClass("selected");

3. Filter data

Copy code The code is as follows:

$("#filter ").click(
function(){
$("#table3 .datarow").hide().filter(":contains('ABCDEFG')").show();
}
);

4. Instantly filter data based on user input
Copy code Code As follows:

$("#keyword").keyup(function(){
$("#table3 .datarow").hide().filter(":contains('" ($(this).val()) "')").show();
}).keyup();

Before screening:

Enter ck:



Online demohttp://demo.jb51.net/js/2012/JQueryTableExample/
Package downloadJQueryTableExample_Edi.rar

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn