Solving this assignemnt. CSS and html code is given! But the add div tag function is not working. How to add div tag to the html page after remove?
Write a code for following :
a)Write CSS Class Header block : border 1, color- blue , font size-20, font name- arial, padding 50px.
b)Write CSS Class Footer block: border 1, color- black , height-20% ,width-100 %, back ground color- grey;
c)Write a jquery code for Add Header block Class and Footer block on button click.
d)Write a jquery code for Remove Header block Class and Footer block on button click.
e)Write a jquery code for Toggle Header block Class and Footer block on button click.
$(document).ready(function() {
$('.remove').click(function() {
$('.header').remove();
$('.footer').remove();
});
});
$(document).ready(function() {
$('.add').click(function() {
$('body').addClass('div.header');
$('body').addClass('div.footer');
});
});
.header {
border: 1px solid;
color: blue;
font-size: 20;
font-family: arial;
padding: 50px;
}
.footer {
border: 1px solid;
color: black;
height: 20%;
width: 100%;
background-color: grey;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<head>
<link rel='stylesheet' style='text/css' href='a30.css'></link>
<script src='../jquery.js'></script>
</head>
<body>
<div class='header'>
This is header!
</div>
<button class='add'>Add</button>
<button class='remove'>Remove</button>
<div class='footer'>
This is footer!
</div>
</body>
</html>
Please help me find a solution!