Jquery inputmask casing uppercase/lowercase

不羁岁月 提交于 2019-12-23 04:06:33

问题


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" />

回答1:


.uppercase {
  text-transform: uppercase;
}

.lowercase {
  text-transform: lowercase;
}

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

Use css.




回答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.



来源:https://stackoverflow.com/questions/42499481/jquery-inputmask-casing-uppercase-lowercase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!