Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
  <title>Events in JavaScript: Removing event listeners</title>
</head>
<body>
  <button id="element">Click Me</button>
</body>
</html>
 
var element = document.getElementById('element');
function callback() {
  alert('Hello once');
  element.removeEventListener('click', callback);
}
// Add listener
element.addEventListener('click', callback);
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
wilsonpagepro
0viewers