jquery: Nth-child (an+b) Use attention _jquery

Source: Internet
Author: User

The next two class is empty to adjust the column width to accommodate the number of columns that might be added
$ ("Div>p"). Parent (). Not ($ (". Grid_2")). Filter ("Nth-child (" +lenth+ "n+1)") to select the 2nd column of each row, but the third column is selected, baffled
Using the Firbug query the element is unintentionally found under the elements of the Nodeindex (Nodeindex in the order of the same element) and parameter An+b calculated the same value, the original want to directly use the Nodeindex to select the 2nd column okay, but don't know how to do it.
Check the next Baidu inadvertently found Nth-child is also the use of Nodeindex Select the specific implementation of the following
Copy Code code as follows:

filters:{
such as $ ("input[name^= ' News ']") "<inputname=" Newsletter "/>"
Attr:function (Elem,match) {
VARRESULT=EXPR.ATTRHANDLE[MATCH[1]]? EXPR.ATTRHANDLE[MATCH[1]] (elem): elem[match[1]]| | Elem.getattribute (Match[1]), value=result+ "", type=match[2],check=match[4];
Returnresult==null?
type=== "!=":
type=== "="?
Value===check:
type=== "*="?
Value.indexof (check) >=0:
type=== "~="?
("+value+"). IndexOf (check) >=0:
!MATCH[4]?
Result
type=== "!="?
Value!=check:
type=== "^="?
Value.indexof (check) ===0:
type=== "$="?
Value.substr (value.length-check.length) ===check:
type=== "|="?
value===check| | Value.substr (0,check.length+1) ===check+ "-":
False
}
}

The original: Nth-child (AN+B) is chosen based on the Nodeindex value under the parent element of the element (that is, the child element is selected from the parent element of your current element) instead of the nth in the child element of the remaining element.

So I used. Not to filter out the first column does not make the second column of nodeindex=2 a "first column"

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.