最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin8PV0评论

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;
}
Post a comment

comment list (0)

  1. No comments so far