What is addEventlistener, How can we use them in Javascript
I would like to see a basic example where it shows me how to use addEventListner and remove EventLister.
Add Comment
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Event Listners</title>
</head>
<body>
<div id="menu1" >Home</div>
<div id="content1"> </div>
<script type="text/javascript">
var menu1 = document.getElementById('menu1');
var content1 = document.getElementById('content1');
menu1.addEventListener('click', clickfunciton);
menu1.addEventListener('mouseover', mouseoverfunction);
menu1.addEventListener('mouseout', mouseoutfunction);
menu1.removeEventListener('mouseout', mouseoutfunction);
function clickfunciton(){
content1.innerHTML = " I am an Indian";
}
</script>
</body>
</html>