For a table, in order to make our selected items easier to distinguish, we need to add highlighting to the selected items, as well as to remove the highlighted form of other items. Similar to:
<!DOCTYPE HTML><HTMLLang= "en"xmlns= "http://www.w3.org/1999/xhtml"><Head> <MetaCharSet= "Utf-8" /> <title></title> <Linkhref= "Css/style.css"rel= "stylesheet"type= "Text/css" /> <Scriptsrc= "Jquery-1.3.2.min.js"></Script> <Script> $(function () { $('tbody>tr'). Click (function () { $( This). addclass ('selected') //Add highlighting to selected items . Siblings (). Removeclass ('selected')//Remove the highlight form of other items . end (); }); }); </Script></Head><Body> <Table> <thead> <TR><th>Name</th><th>Gender</th><th>Temporary land</th></TR> </thead> <tbody> <TR><TD>Tom</TD><TD>Man</TD><TD>Ningbo, Zhejiang</TD></TR> <TR><TD>Tom</TD><TD>Man</TD><TD>Ningbo, Zhejiang</TD></TR> <TR><TD>Tom</TD><TD>Man</TD><TD>Ningbo, Zhejiang</TD></TR> <TR><TD>Tom</TD><TD>Man</TD><TD>Ningbo, Zhejiang</TD></TR> <TR><TD>Tom</TD><TD>Man</TD><TD>Ningbo, Zhejiang</TD></TR> </tbody> </Table></Body></HTML>
jquery Implementation table click on the corresponding row color function