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?

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:


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

commented: That helped, thanks! +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.