Jquery: Capitalize the First Letter of String Using Jquery

capitalize first letter javascript, capitalize first letter jquery, capitalize first letter using jquery


Today, I am explaining one more working example of Jquery. I have explained how we can capitalize first letter of string using Jquery. It is very common requirements while we are typing sentence in input box. I have used JSfiddle to run here fully working example of Jquery.
Jquery Capitalize First Letter

Step 1: Taking Two Input Box (First Name & Last Name) 

First step taking two input boxes to illustrate the example with all functionality.

First Name: Last Name:

Step 2: Writing Jquery Kepypress Event to Capitalize First Letter 

Now writing Jquery code to Capitalize first letter of string using Jquery

  $("#txtFirstName").keypress(function () {
      var _val = $("#txtFirstName").val();
      var _txt = _val.charAt(0).toUpperCase() + _val.slice(1);

   $("#txtLastName").keypress(function () {
      var _val = $("#txtLastName").val();
      var _txt = _val.charAt(0).toUpperCase() + _val.slice(1);

Complete Working Example to Capitlize first letter of String


I have explained all important steps to capitalize first letter of string using Jquery. Jsfiddle used to run example real time online. If anyone need more help, then let me know.

Relevant Reading


Anjan kant

Outstanding journey in Microsoft Technologies (ASP.Net, C#, SQL Programming, WPF, Silverlight, WCF etc.), client side technologies AngularJS, KnockoutJS, Javascript, Ajax Calls, Json and Hybrid apps etc. I love to devote free time in writing, blogging, social networking and adventurous life

Post A Comment: