In a form, I have two buttons to transform text to uppercase and lowercase. I am using this function to transform input text to upper case:
document.xyz.textinput.value=document.xyz.textinput.value.toUpperCase()
Now, I want to add a new button to capitalize each word. Is it possible to achieve this with the following code?
document.xyz.textinput.value=document.xyz.textinput.value.capitalize()
Thanks
Try This:
document.xyz.textinput.value = document.xyz.textinput.charAt(0).toUpperCase() + document.xyz.textinput.slice(1);
If you want a capitalize functions, See here.