onkeyup will run every time a key is released. Although this looks like a solution, it has some problems.
If the user moves the cursor with arrows, it starts, and you must check yourself if the field value has changed.
If the user copies / pastes the value into the input field using the mouse or cancels the cancel / redo in the browser, onkeyup does not start.
Mac google, , , .
, .
, , elm - , - , :
<html>
<head>
<title>so</title>
</head>
<body>
<input type="text" onfocus="changeField(this, fldChanged);">
<script>
function changeField(elm, after){
var old, to, val,
chk = function(){
val = elm.value;
if(!old && val === elm.defaultValue){
old = val;
}else if(old !== val){
old = val;
after(elm);
}
};
chk();
to = setInterval(chk, 400);
elm.onblur = function(){
to && clearInterval(to);
elm.onblur = null;
};
};
function fldChanged(elm){
console.log('changed to:' + elm.value);
}
</script>
</body>
</html>