How do you automatically set text box to Uppercase?

后端 未结 12 604
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-29 23:50

I am using the following style attribute to set the user input to uppercase so that when the user starts typing in the text box for example railway, then it should

12条回答
  •  遥遥无期
    2021-01-30 00:36

    As nobody suggested it:

    If you want to use the CSS solution with lowercase placeholders, you just have to style the placeholders separately. Split the 2 placeholder styles for IE compatibility.

    input {
        text-transform: uppercase;
    }
    input:-ms-input-placeholder {
        text-transform: none;
    }
    input::placeholder {
        text-transform: none;
    }
    The below input has lowercase characters, but all typed characters are CSS-uppercased :

提交回复
热议问题