TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Change first letter of a text-box capital using JavaScript
Manish Kumar Choudhary
Nov 25
2014
Code
3.8
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Use following function inside textbox. It will change the first letter of text-box to capital when focus goes out from text-box.
onblur=
"this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);"
Example
<
asp:TextBox
ID
=
"txtuser"
runat
=
"server"
placeholder
=
"User Name"
autocomplete
=
"off"
onblur
=
"this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);"
>
</
asp:TextBox
>
JavaScript
text-box text change using JavaScript