How to change background color with jquery

change background color with jquery is easy you just need to change body css on an event. You can change the background color of any content just replace the body with your content name.

Jquery

$(document).ready(function(){
  $('#red').click(function(){
   $('body').css("background-color","#ff0000");
  });
  $('#green').click(function(){
   $('body').css("background-color","#009900");
  });
  $('#blue').click(function(){
   $('body').css("background-color","#0066FF");
  });
 });

HTML

Red
Green
Blue
Download File Used in this example View Live Demo

No comments:

Post a Comment