172k views
2 votes
In jQuery, what does the selector $("div#intro .head") select?

a. All div elements with id "intro" and class "head"
b. The first div element with id "intro" and class "head"
c. All elements with class "head" inside a div with id "intro"
d. The parent div of an element with id "intro" and class "head"

User Asmaa
by
7.2k points

1 Answer

3 votes

Final answer:

The jQuery selector $("div#intro .head") selects all elements with class 'head' inside a div with id 'intro'.

Step-by-step explanation:

In jQuery, the selector ("div#intro .head") selects all elements with the class .head that are inside a div element with the ID #intro. This is a descendant selector which looks for elements that match the .head class within the context of the specified div with the intro ID. Importantly, the div with ID intro does not need to have the class head, and there can be multiple .head elements within that div which would be selected.

User Sid S
by
7.7k points