Multiple choice technology web technology

which is a valid syntax of css jquery?

  1. ("p").css("background-color","yellow");

  2. $("p").css("background-color","yellow")
  3. $("p").css("background-color","yellow");
  4. $("p").css("back-color","yellow");
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The correct jQuery syntax requires the $ selector function, followed by the .css() method. Option C is correct: $("p").css("background-color","yellow"); - the $ creates a jQuery object, .css() takes two string arguments (property and value), and the semicolon terminates the statement. Option A is missing the $, Option B is missing the semicolon, and Option D uses an incorrect property name.