How could I force the text in the \"username\" text input
to be lower-case regardless of what user types?
This is my suggestion, it's based on the answer from @fdiv-bug & @ali-sheikhpour:
input[type="email"] {
text-transform: lowercase;
}
var upperCaseMatch = /[A-Z]/;
var events = {
CHANGE: 'change'
};
$(function() {
$(document).on('change', 'input[type="email"]', function() {
var value = $(this).val();
if (!upperCaseMatch.test(value)) {
return;
}
$(this).val(value.toLowerCase());
});
});
Hope its useful for you.