最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to Auto-Capitalize a text input in phonegap for Android? - Stack Overflow

programmeradmin0浏览0评论

Is there a (non hacking) way to set autocapitalize="on" (like iOS) in phonegap for Android?

If not, is there any way to "auto press" shift after the user focuses on a form field such as <input ... type="text">?

Is there a (non hacking) way to set autocapitalize="on" (like iOS) in phonegap for Android?

If not, is there any way to "auto press" shift after the user focuses on a form field such as <input ... type="text">?

Share Improve this question edited Aug 24, 2012 at 22:21 David M 1,16112 silver badges22 bronze badges asked Jul 20, 2012 at 20:01 Julio RodriguesJulio Rodrigues 3,4134 gold badges25 silver badges33 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 3

You can use a textarea width height: 22px (or more).

<textarea style="height: 22px" ...></textarea>

Discovered by accident, using ICS with cordova 1.9.0

via jQuery:

$('input[type="text"]').on('keypress', function() { 
    var $this = $(this), value = $this.val(); 
    if (value.length === 1) { 
      $this.val( value.charAt(0).toUpperCase() );
    }  
});

Just use css

input[type=text] {
    text-transform:uppercase;
}
发布评论

评论列表(0)

  1. 暂无评论