Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Dom Mouse Event">
  <meta charset="utf-8">
  <title>DOM Mouse Event</title>
</head>
<body>
  
  <input id="inputID" type="text" />
  
</body>
</html>
 
#group {
  position: absolute;
  left: 250px;
  top: 50px;
  background-color: green;
}
 
window.onload = function () {
  
  var inputclick = document.getElementById('inputID');
  
  inputclick.addEventListener('click', showMouse);
  inputclick.addEventListener('mousedown', showMouse);
  inputclick.addEventListener('mouseup', showMouse);
  
  function showMouse(event) {
    js.log(event.type);
  }
};
//// utils
var js = {
  lineNumber: 1
};
js.log = function(text) {
  var node, child, lineText;
  node = document.getElementById('result');
  if (!node) {
    node = document.createElement('div');
    node.id = 'result';
    document.body.appendChild(node);
  }
  child = document.createElement('div');
  lineText = js.lineNumber + '.';
  lineText = Array.isArray(text) ? lineText + '[' + text + ']' : lineText + text;
  if (arguments.length > 1) {
    for (var k = 1; k < arguments.length; k++) {
      lineText += arguments[k];
    }
  }
  child.innerText === undefined ? child.textContent = lineText : child.innerText = lineText;
  node.appendChild(child);
  js.lineNumber += 1;
  return this;
};
Output

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

Dismiss x