87.4k views
0 votes
Which of the following JavaScript methods is used to define an object collection based on a CSS (Cascading Style Sheets) selector? ​ a. object.style.property = ""value(selector)"" b. object.property = ""value(selector)"" c. document.getElementbyId(selector) d. document.querySelectorAll(selector)

1 Answer

6 votes

Answer:

The answer is option d.

Explanation:

The 'querySelectorAll' function enables you to extract the list of items that fit the CSS selector you choose. It's just a way to find JavaScript components. It is very adaptable and enables you to search for tags, classes, IDs, combinations of parent/child, attributes, etc.

In other words, we can say that the querySelectorAll() method returns all the matches. and other options are not correct that can be described as follows:

  • In option a and b, the object is a collection of unordered properties, that can be changed in adding, deleting and read-only. The option a is an attribute, that is used in CSS and option b is used in JavaScript for the property name.
  • In option c, It reverts the element with the fixed value, that has the ID attribute.
User GoTLiuM
by
5.2k points