GDES-315 Exercise_15.7
Adding a new CSS class on a click of a button
by emilytrabert
HTML
<body>
<button> Change the background color! </button>
<div class="demo">
Click the button above to change my background color from blue to red!
</div>
</body>
CSS
.demo {
width: 350px;
padding: 100px;
color: #FFFFFF;
background-color: #86B6BD;
}
.new {
background-color: #F55E40;
}
JavaScript
/* Write code that executes the following:
When a button is clicked, a "new" class is assgned to the blue box
*/
$('button').click(function(){
$('.demo').addClass('new');
});