9
9
DOCTYPE html>
<html lang="en">
<head>
<div class="container">
<ul id="list">
<li>Item 1</li>
<li>Item 2</li>
</ul>
<button id="append-to-list">Append to List</button>
</div>
<div class="container">
<button id="animate-box">Animate Box</button>
<div class="animate-box"></div>
</div>
<script>
$(document).ready(function () {
// a. Append content at the end of existing paragraph and list
$('#append-to-paragraph').click(function () {
$('#paragraph').append(' Appended content!');
});
$('#append-to-list').click(function () {
$('#list').append('<li>Appended item</li>');
});
// b. Change the state of the element with CSS style using animate()
$('#animate-box').click(function () {
$('.animate-box').animate({
width: '200px',
height: '200px',
marginLeft: '50px'
}, 1000, function () {
// c. Change the color of the div when the animation is
complete
$(this).addClass('highlight');
});
});
});
</script>
</body>
</html>