oninputイベントで文字の変化を監視する
HTMLで入力ボックスに入力された文字列が空白だった場合は決定ボタンを無効化する場合などに。
IME有効時やペーストでも反応するので onkeypress などの類似イベントより正確に判定できると思う。
var input = document.createElement('input'); input.oninput = function () { console.log('change text.'); }; document.body.appendChild(input);
IE8以前のバージョンはサポートされていないらしいので注意。
http://www.w3schools.com/jsref/event_oninput.asp