1, table odd rows and even rows add style
Copy Code code as follows:
$ (function () {
$ (' tr:odd '). addclass ("odd");
$ (' Tr:even '). addclass ("even");
});
Not counting the head of the table
Copy Code code as follows:
$ (function () {
$ (' tbody>tr:odd '). addclass ("odd");
$ (' Tbody>tr:even '). addclass ("even");
});
2, the Radio box control line highlighting
Copy Code code as follows:
$ (' tobdy>tr '). Click (function () {
$ (this). AddClass (' selected ')
. siblings (). Removeclass (' selected ')
. End ()//re-return the object
. FIND (': Radio ') attr (' checked ', true);
});
3, check box control line highlighting
Copy Code code as follows:
$ (' tobdy>tr '). Click (function () {
if ($ (this). Hasclass (' selected ')) {//To determine if there is a selected highlighting style
$ (this). Removeclass (' selected ')
. Find (': CheckBox '). attr (' checked ', false);
}else{
$ (this). AddClass (' selected ')
. Find (': CheckBox '). attr (' checked ', true);
}
});
4. Table Content Screening
Copy Code code as follows:
$ (function () {
$ (' Table tbody tr '). Hide ()
. Filter (": Contains (Lee)"). Show ();
});