开发者

Is there a difference between 'span :first' and 'span:first' in JQuery Selectors?

开发者 https://www.devze.com 2022-12-30 08:22 出处:网络
Could someone tell me the difference bet开发者_运维知识库ween those two. The first one is working on FF and not in IE (6) and second one is working in IE (6) and not in FF (I am using the Jquery 1.4.2

Could someone tell me the difference bet开发者_运维知识库ween those two. The first one is working on FF and not in IE (6) and second one is working in IE (6) and not in FF (I am using the Jquery 1.4.2). We had to detect the browser and write the script accordingly.


One has a descendant selector in the middle of it.

span:first

Will select "All span elements that the :first pseudo-class applies to"

span :first

Will select "All elements which have the :first pseudo-class applied to them AND which are descended from a span element"

There isn't actually a :first pseudo-class though. You might mean :first-child, :first-line or :first letter.

(Oh, :first is some jQuery specific stuff, that explains why SelectOracle didn't know about it)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号