CoinHive

Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Wednesday, January 4, 2017

Textfield in upper or lower case

In most applications you would like to keep some text fields in upper case. For example: car license plates, ID numbers, passport numbers etc.

We can achieve this with a simple javascript in the custom attributes of the field.
onKeyUp="this.value=this.value.toUpperCase();"
Or similarly for lower case:
 onKeyUp="this.value=this.value.toLowerCase();"
See example here.

EDIT 24-apr-2018:
Alternatively we could also use CSS to display textfields in upper or lower case with:
 u-textUpper u-textLower
Be advised though, this only changes the display.