Which is the correct jQuery statement to change the color of all <p> elements which are sibling elements of <pre>?

96. Which is the correct jQuery statement to change the color of all <p> elements which are sibling elements of <pre>?

  1. $("#pre").siblings("p").css({"color": "red"});
  2. $(".pre").siblings("p").css({"color": "red"});
  3. $("pre").siblings(".p").css({"color": "red"});
  4. $("pre").siblings("p").css({"color": "red"});

Answer: D) $("pre").siblings("p").css({"color": "red"});

Explanation:

The correct jQuery statement to change the color of all <p> elements which are sibling elements of <pre> is:

$("pre").siblings("p").css({"color": "red"});

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.