Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

open android and ios keyboard with uppercase using html

i am creating a web page for mobile devices. In that there are few input fields which require user to always enter data in uppercase.

I looked at few options like

  1. text-transform property of css
    It changes user input to uppercase but it also changes the placeholder. That doesn't looks good.
  2. autocapitalize attribute for input
    By setting it on, it allows keyboard to open in caps. But this doesn't seems to work for me. It works perfectly with textarea but not with input in android.

Is there any better way to achieve this?

like image 849
S4beR Avatar asked Oct 21 '22 07:10

S4beR


1 Answers

try adding autocapitalize="characters" to input, it worked for me on Android, and it should work on other kind of devices as MDN web docs says here:

The autocapitalize attribute doesn’t affect behavior when typing on a physical keyboard. Instead, it affects the behavior of other input mechanisms, such as virtual keyboards on mobile devices and voice input.

like image 131
Stefano Populin Avatar answered Oct 23 '22 01:10

Stefano Populin