0

I am learning jQuery from thenewboston. I have learnt about ID selectors (#) and element selectors (<html element>). They have also used the colon selector (:). What is the colon selector for? Can somebody please explain in an easy way?

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by JorgeM
1

Just like in CSS, the : selector allows you work on the element you are searching for with greater precision. For example, say you only wanted to select the first paragraph element. you could do so by using the following syntax:

$("p:first")

Full documentation and more examples here: http://api.jquery.com/category/selectors/

Votes + Comments
That helped, thanks!
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.