-2

I have an assignment where I have to create a website. one of the requirements is that I must have a button that changes the color of my background, i don't know how to do it. any help would be appreciated.

Kara
  • 6,115
  • 16
  • 50
  • 57
user218001
  • 35
  • 1
  • 8
  • You need to show some attempt at solving this on your own before asking for help. Try googling "how to change background color with javascript" and if you still have trouble, THEN you should post your code and question on StackOverflow... – Justin Jun 03 '13 at 23:19

1 Answers1

1

You need to use javascript or jquery:

http://jsfiddle.net/FnNpX/1/

$('button').on('click', function () {
  $('body').css('backgroundColor', 'red');
});