1

I search on the web, but all the solutions are mobile only. Is there any autocapitalize attribute for desktop browser such as Chrome, Firefox or Safari not in mobile devices.

What I actually want to do is that I want the create an input text, and in the scenario when user type something, input must start with capitalized letter

Is there any way to do it

Mehmet Eren Yener
  • 2,006
  • 1
  • 23
  • 37
  • possible duplicate of [make the first character uppercase in css](http://stackoverflow.com/questions/5577364/make-the-first-character-uppercase-in-css) – Rahul Kadukar Dec 11 '13 at 17:05
  • 1
    Should the text be displayed with a capital letter, or should it actually be changed so that when the form is submitted, the submitted input has a capital letter? – Nic Wortel Dec 11 '13 at 17:06

2 Answers2

4

Try:

input {
    text-transform: capitalize;
}

See this fiddle here

To extend on the answer if you wish the first letter to be capitalized on submit, you need to either add some javascript, e.g.:

$('input[type="text"]').keyup(function(evt){

      // force: true to lower case all letter except first
      var cp_value= ucfirst($(this).val(),true) ;

      // to capitalize all words  
      //var cp_value= ucwords($(this).val(),true) ;


      $(this).val(cp_value );

   });

(From this post)

Or perform some post processing on the server side (such as by using e.g. in php ucfirst($string);

Community
  • 1
  • 1
SW4
  • 69,876
  • 20
  • 132
  • 137
0
input{
  text-transform: capitalize;
}

http://jsfiddle.net/RtA4k/

Rahul Kadukar
  • 858
  • 3
  • 15
  • 35