make first letter capital in javascript - Javascript Views : 766
Tagged in : Javascript
0 0
Send mail
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
By Ramya, On - 2010-03-01



    Login to add Comments .