views:

68

answers:

1

Could someone tell me the difference between 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.

+7  A: 

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)

David Dorward
Raja
No, since (a) That would be a `<first-child>` element in a `<span>` etc and (b) `span:first-child` would be a span if it was the first child, not the first span. (You might want first-child, but it isn't what you had originally)
David Dorward
yup got it thanks :-)
Raja