In the table of Jquery, select the background color and radio according to the row.

Source: Internet
Author: User

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 ');

Related Article

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.