How does jQuery obtain specified rows and columns of a table,

Source: Internet
Author: User

How does jQuery obtain specified rows and columns of a table,

How does jQuery obtain the specified rows and columns of a table:
When performing operations on heap tables, you often need to obtain the specified rows and columns, that is, you need to precisely locate them. This chapter briefly introduces how to implement this function.
1. Get the specified row:
Because the code is relatively simple, the complete code is not provided here. Only the code snippets are provided:
1. Add a class for the last row of cells in the table.

 

$ ("# Mytable tr: last"). find ("td"). addClass ("setcolor ")

 

2. Add a class for the cell in the first row of the table.

$ ("# Mytable tr"). get (0). find ("td"). addClass ("setcolor ")

2. Get the specified cell:
This can be precisely located based on the obtained rows.
1. Add a class for the second cell in the first row.

$ ("# Mytable tr"). get (0). find ("td"). get (1). addClass ("setcolor ")

The above may not be the most optimized solution, but it just provides an idea.
Related reading:
1. For more information about the find () function, see find () method in jQuery.
2. For details about addclass () functions, refer to the addClass () method section of jQuery.
3. For details about the get () function, see the get () method section of jQuery.

The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 8807.

For more information, see: http://www.softwhy.com/jquery/

 

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.