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/