Archive for the ‘ECMAScript’ Category

input’s difficult event handle

Posted: March 16, 2011 in ECMAScript

When user drag and drops the text directly into the Input control, the onkeyup event is not fired as no keyboard is involved.
You can use onfocus event to fix the problem. Like this:

function processInput() {
  // your logic
var $element = document.getElementById('elementid');
$element.onfocus = $element.onkeyup = processInput;

also you should use input event in firefox and chrome

How to detect right mouse click + paste using JavaScript?