Home  >  Article  >  Web Front-end  >  How to get the row and column of the current element in jquery

How to get the row and column of the current element in jquery

WBOY
WBOYOriginal
2021-11-30 19:23:244039browse

Method: 1. Use the index() and parent() methods to obtain the row position of the current element. The syntax is "element object.parent().index() 1;"; 2. Use index() Method to get the column position of the current element, the syntax is "element object.index() 1;".

How to get the row and column of the current element in jquery

The operating environment of this tutorial: windows7 system, jquery3.2.1 version, Dell G3 computer.

How jquery gets the row and column of the current element

We can get it through the index() method and parent() method Which row and column is the current element in? The example is as follows:






1234
2456
3789
4123

Output result:

How to get the row and column of the current element in jquery

When one of the cell elements is clicked , Output result:

How to get the row and column of the current element in jquery

Related video tutorial recommendations: jQuery video tutorial

The above is the detailed content of How to get the row and column of the current element in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn