Jquery inputmask casing uppercase/lowercase
Asked Answered
O

2

4

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" />
Outshine answered 28/2, 2017 at 3:9 Comment(1)
If you have a choice try unmanner.github.io/imaskjsConventionality
O
2

.uppercase {
  text-transform: uppercase;
}

.lowercase {
  text-transform: lowercase;
}

.capitalize {
  text-transform: capitalize;
}
<input class="uppercase" />
<input class="lowercase" />
<input class="capitalize" />

Use css.

Onfre answered 28/2, 2017 at 3:23 Comment(2)
css only applies in display text not in value. thanks anyways :)Outshine
onblur="this.value = this.value.toUpperCase();" for text value, it would work behind the scene.Holeandcorner
A
-2

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.

Aridatha answered 28/2, 2017 at 4:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.