我有一个使用伪选择器first-child
的 css 样式:
.point:first-child {
margin-left: 0;
}
有没有办法检查某些特定的 DOM 元素是否应用了伪选择器的类point
:first-child
? .getAttribute("class")
不起作用,它只会返回"point"
CSS 伪类将在元素本身中可用,但仅在 css 部分可用。尝试在 JQuery 选择器上使用此选择器 ".point:first"