mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
js to prevent chars in serial
This commit is contained in:
@@ -137,6 +137,20 @@ $(function () {
|
||||
});
|
||||
});
|
||||
|
||||
// Some Browsers (Firefox...) allow Chars in Serial Input. We don't want that.
|
||||
// reference: https://stackoverflow.com/questions/49923588/input-type-number-with-pattern-0-9-allows-letters-in-firefox
|
||||
$(function () {
|
||||
$('#exch_serial_s, #exch_serial_r').on('keypress', function (e) {
|
||||
var charCode = e.which || e.keyCode;
|
||||
var charStr = String.fromCharCode(charCode);
|
||||
|
||||
if (!/^[0-9]+$/.test(charStr)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Here we capture keystrokes to execute functions
|
||||
document.onkeyup = function (e) {
|
||||
// ALT-W wipe
|
||||
|
||||
Reference in New Issue
Block a user