Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Web technologies Questions | jQuery Quiz | Set-1 | Question 2

  • Last Updated : 21 Sep, 2021

Which of the following is the correct syntax to set the background color of all h1 elements to Green in jQuery?
(A) $(“h1”).html(“background-color”,”Green”);
(B) $(“h1”).layout(“background-color”,”Green”);
(C) $(“h1”).style(“background-color”,”Green”);
(D) $(“h1”).css(“background-color”,”Green”);


Answer: (D)

Explanation: In jQuery, using the css() method, we can set the style of an HTML element. The correct syntax for setting the background color to yellow of an h1 element is – $("h1").css("background-color","Green|");

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!