The last two Classes are empty to cope with the possible increase in the number of columns to adjust the column width
$("div>p").parent().not($(".grid_2")). filter("nth-child(" lenth "n 1)") to select the second column of each row, but the third column was selected, which is puzzling
Using firbug to query the element, I accidentally found that under the element nodeindex (nodeindex is the order of elements at the same level) is the same as the calculated value of parameter an b. I originally wanted to use nodeindex to select column 2 directly, but I don’t know how to do it
I checked Baidu and accidentally found nth- The specific implementation of child selection using nodeindex is as follows:
filters:{
//Such as $("input[name^='news']")【】
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;
}
}
It turns out that nth-child (an b) is selected based on the nodeindex value of under the parent element of (that is, it will be selected from the parent of your current element) element), instead of selecting the Nth
among the child elements of the remaining elements
So I used .not to filter out the first column but I couldn’t make the second column with nodeindex=2 become the "first column"
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