In the table of Jquery, select the background color and radio according to the row.
Function: click a row in the list, and the current row will be changed to another color, and the radio will be selected.
<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %> <% String path = request. getContextPath (); String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path; %> <! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
I didn't know much about end usage at the beginning of my study. I 'd like to explain it to myself. Thank you for your advice. END () is used after the instructions in the official documentation return to the latest "destructive" operation. Changes the list of matched elements to the previous state. I believe many people do not understand its usage. For example, <p> <span> Hello </span>, how are you? </P> jQuery code: $ ("p "). find ("span "). the return value of end () is [<p> <span> Hello </span> how are you? </P>] is actually: Find the <span> tag in the P tag, and END the reference to the P tag using the END () method. In this case, the P tag (JQuery) is returned) the object is like the first example. If I use end (), the statement is
<script type="text/javascript">$(document).ready(function(){ $("tbody>tr").click(function(){ $(this) .addClass('sel') .siblings().removeClass('sel'); $(this).find(':radio').attr('checked',true); });})</script>
If a table is selected during initialization, the Code is as follows: $ ("table: radio: checked "). parent (). parent (). addClass ('sel '); or $ ("table: radio: checked "). parents ("tr "). addClass ('sel '); or $ ('tbody> tr: has (: checked )'). addClass ('sel ');