我试图在三星安卓手机上的html文本输入字段中获取全部小写。
有人可以建议其他方法尝试停止文本字段中第一个字母的自动大写吗?
我尝试过以下操作,但没有任何作用。
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)"
答案 0 :(得分:11)
您需要在标记中说autocapitalize =“off”
示例
<input type="text" autocorrect="off" autocapitalize="off"/>
Click here了解详情。
答案 1 :(得分:7)
对于Android手机,您必须使用array $attributes = []
所以,如果你想要通用的东西,那么完整的@ kumars&#39;这样回答:
autocomplete="off"
autocorrect和autocapitalize属性适用于iPhone或iPad,自动完成适用于任何运行Android的设备。
注意:使用<input type="text" autocorrect="off" autocapitalize="none" autocomplete="off"/>
代替autocapitalize="none"
因为&#34;关闭&#34;不适用于autocapitalize。请参阅official documentation。
答案 2 :(得分:0)
如果您还在使用React,请使用autoCapitalize="none"
。