make first letter capital in javascript

by Ramya 2010-03-01 20:04:26

Make first letter capital in Javascript:

Use toUpperCase() to make first letter capital.
variable-name.charAt(0).toUpperCase + slice the first letter as string.slice(1)

For eg,
var string = "hscripts.com";
document.getElementById('div').value = string.charAt(0).toUpperCase()+string.slice(1);


Razz

Tagged in:

2093
like
0
dislike
0
mail
flag

You must LOGIN to add comments