jquery Radio box check box table highlighting

Source: Internet
Author: User

Radio Box:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >< HTML xmlns= "http://www.w3.org/1999/xhtml" xml:lang= "en" lang= "en" >    $(function(){        $("Tbody>tr:odd"). AddClass ("odd");//exclude the first line and then add a style to odd rows$ ("Tbody>tr:even"). AddClass ("even");//exclude the first row and then add a style to even rows$ (' tbody>tr '). Click (function() {            $( This). addclass (' Selected ') //The current object is $ (this) . Siblings (). Removeclass (' Selected ') //The current object is $ (this). Siblings () . End () //The current object is $ (this) . Find (': Radio '). attr (' checked '),true);        }); //High Color If the radio box is selected by default.         //$ (' table:radio:checked '). Parent (). Parent (). AddClass (' selected ');        //Simplified:$ (' table:radio:checked '). Parents ("tr"). AddClass (' selected ')); //further simplification:         //$ (' Tbody>tr:has (: Checked) '). AddClass (' selected ');    })</script>    $(function(){        $("Tbody>tr:odd"). AddClass ("odd");//exclude the first line and then add a style to odd rows$ ("Tbody>tr:even"). AddClass ("even");//exclude the first row and then add a style to even rows$ (' tbody>tr '). Click (function() {            if($( This). Hasclass (' selected ')) {                $( This). Removeclass (' Selected '). Find (': CheckBox '). attr (' checked ',false); }Else{                $( This). addclass (' Selected '). Find (': CheckBox '). attr (' checked ',true);        }        }); //If the check box is selected by default, the high color.        //$ (' table:checkbox:checked '). Parent (). Parent (). AddClass (' selected ');        //Simplified:$ (' table:checkbox:checked '). Parents ("tr"). AddClass (' selected ')); //$ (' Tbody>tr:has (: Checked) '). AddClass (' selected ');  })</script>  $(function(){        $("Tbody>tr:odd"). AddClass ("odd")); $("Tbody>tr:even"). AddClass ("even")); $(' Tbody>tr '). Click (function() {            //determines whether the current selection            varhasselected=$ ( This). Hasclass (' selected '); //If selected, move out of the selected class, or add the selected class$( This) [hasselected?] Removeclass ":" AddClass "] (' selected ') //[hasselected?] Removeclass ":" AddClass "] is a three-mesh operator
$ (this) ["Removeclass"] ("selceted"), or $ (this) ["AddClass"] (' selected ');
They are equivalent to: $ (this). Removeclass (' selected ') or $ (this). AddClass (' selected '); //Find the Internal checkbox and set the corresponding properties. . Find (': CheckBox '). attr (' checked ',!hasselected); }); //If the check box is selected by default, the high color.$ (' Tbody>tr:has (: Checked) '). AddClass (' selected '); })</script>collapse:collapse;} TD {Font:normal 12px/17px arial;padding:2px;width:100px;} Th {font:bold 12px/17px arial;text-align:left;padding:4px;border-bottom:1px solid #333;}. Even {background: #FFF38F;} /* even line style */ . Odd {background: #FFFFEE;} /* Odd Line Style */ . Selected {background: #FF6500; color: #fff;}

jquery Radio box check box table highlighting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.