jquery set background color code example

Example 1: change background colour jquery

$(document).ready(function() {
  $("button").mouseover(function() {
    var p = $("p#44.test").css("background-color", "yellow");
    p.hide(1500).show(1500);
    p.queue(function() {
      p.css("background-color", "red");
    });
  });
});

Example 2: how to change the background color in jquery

$("#co").click(function(){
   $(this).css({"backgroundColor" : "blue"});
});

Example 3: how to css in jquery

$(init);
    
function init() {
    $("h1").css("backgroundColor", "yellow");
    $("#myParagraph").css({ "backgroundColor": "black", "color": "white" });
    $(".bordered").css("border", "1px solid black");
}

Tags:

Css Example