Clicke Me If You Love ! (Lesson)
<html>
<head>
<title>Testing the Lesson</title>
<style>
button {
background-color: transparent;
border: 2px solid blue;
padding: 30px;
font-size: 2.0rem;
}
button:hover {
background-color: navy;
border: none;
color: white;
cursor: pointer;
}
</style>
</head>
<body>
<button>CLICK ME IF YOU LOVE</button>
<div class=" container"></div>
<script>
function onClickEvent() {
const el= document.createElement('p');
el.innerText = 'I LOVE U';
document.querySelector('.container').appendChild(el);
}
document.querySelector('button').onclick = onClickEvent;
</script>
</body>
</html>
Comments
Post a Comment