Consider the following snippet documentquerySelectorbananast

Consider the following snippet

document.querySelector(\".banana\").style.color = \"red\";

a) stes the color of the first DO element with style class .banana to red

b) replaces the style class .banana to be just \"color: red\"

c) sets the text of all DOM elements with style class .banana to red

d) sets the text of the first DOM element with style class .banana to red

e)  sets the color of all DOM element with style class .banana to red

Solution

Option d is correct answer.

d.ets the text of the first DOM element with style class .banana to red

The querySelector() method returns the first element that matches a specified CSS selector(s) in the document and apply the given style to that return element.

Consider the following snippet document.querySelector(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site