Im using jquery inputmask
How can I use below code to any input text with out a mask? any letter inputted will force to uppercase.
Inputmask.extendAliases({
uppercase: {
mask: '' // any letters
definitions: {
'*': {
casing: "upper" //
}
}
});
js
$('.uppercase').inputmask({casing:'upper'});
$('.lowercase').inputmask({casing:'lower'});
html
<input type="text" class="uppercase" />
<input type="text" class="lowercase" />
You can bind directly on
input
component using JavaScript:If you're working with HTML5 you can use
oninput
parameter:Or... as you're using jQuery, this works perfectly using
css
class:Same thing as answer above, however changing values using pure jQuery:
Live example:
Reference:
Use css.
You can use @guradio css and just uppercase results on form submit on serverside or with JavaScript before submit.
Or just read https://github.com/RobinHerbots/Inputmask there examples, you can use regexp to limit only to uppercase letters.