Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I stop auto capitalization in a html text input field on an android/samsung phone?

I am trying to get all lowercase in a html text input field on a samsung android phone.

Can anyone suggest something else to try to stop the auto capitalization for the first letter in a text field?

I have tried the following and nothing works.

  • CSS

    .my_username{text-transform:lowercase;}
    
    input[type=text] {text-transform:lowercase;}
    
  • JS

    my_username.setAttribute("autocapitalize","off");
    
    in submitonenter(my_username.value.toLowerCase();)
    
  • HTML

    input autocapitalize="off" type="text" class="my_username" name="username" size="19" value="" maxlength="19" onkeypress="submitonenter(event,this)"
    
like image 334
user1808407 Avatar asked Nov 08 '12 07:11

user1808407


People also ask

How do I turn off auto capitalization in HTML?

Use autocapitalize="none" instead of autocapitalize="off" because "off" is deprecated for autocapitalize .

How do I turn off auto capitalization on Android?

To turn auto caps off on Android, press “Settings” > “Text correction” > “Auto-capitalization.” Tap the toggle to turn it off. Another way is to tap “Settings” > “System” > “Languages and input” > “On-screen keyboard” > Gboard > “Text correction” before pressing the “Auto-capitalization” toggle.


2 Answers

You need to to say autocapitalize="off" in your markup

Example

<input type="text" autocorrect="off" autocapitalize="off"/>

Click here for more details.

like image 160
Soarabh Avatar answered Sep 20 '22 18:09

Soarabh


For android phones you have to use autocomplete="off"

So if you want something generic, complete @kumars' answers this way:

<input type="text" autocorrect="off" autocapitalize="none" autocomplete="off"/>

The autocorrect and autocapitalize attributes works on the iPhone or the iPad, autocomplete is for any device running Android.

NB: Use autocapitalize="none" instead of autocapitalize="off" because "off" is deprecated for autocapitalize. See official documentation.

like image 27
edelans Avatar answered Sep 18 '22 18:09

edelans