Overtype Mode With Jquery
How could I make my input field act as if the keyboard is in overtype mode? I tried to trigger the keypress event with the delete button in keycode when the user enter a value but
Solution 1:
Something like:
<input onkeydown="this.oldSize = this.value.length;"
onkeypress="var n = this; setTimeout(function() {
if(n.value.length > n.oldSize) {
var s = n.selectionStart;
n.value = n.value.substr(0, s) + n.value.substr(s + 1);
n.selectionStart = n.selectionEnd = s;
}
},10);">
Solution 2:
well, i have no idea what you wanna do.maybe this will help you.
Keymaster is a simple (100 LoC or so) micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
Post a Comment for "Overtype Mode With Jquery"