View Post [edit]
Poster: | TechLord | Date: | Feb 3, 2024 1:02am |
Forum: | general | Subject: | Automatic date field for uploader (JavaScript code included) |
Simply add this to the JavaScript code:
function numberpress(keycode) /* checks whether last pressed key is a number so it goes to the next field only then */ {
if(keycode >= 48 && keycode <= 57) /* number row */ return true;
if(keycode >= 96 && keycode <= 105) /* num pad */ return true;
else return false;
}
date_year.addEventListener("keyup", function(key){if (date_year.value.length == 4 && numberpress(key.keyCode) ) { date_month.focus(); } } );
date_month.addEventListener("keyup", function(key){if (date_month.value.length == 2 && numberpress(key.keyCode) ) { date_day.focus(); } } );
I hope this improvement will be implemented.
Again, thank you for this amazing library.