I\'m currently trying to capitalize the very first letter from an input.
Here\'s what I tryed :
fieldset input
{
text-transform:capitalize;
}
You must use
<fieldset>
<legend>DATA...</legend>
<input type="text" class="inputName" placeholder="Введите имя">
without <input />
then in CSS:
fieldset input {
text-transform: capitalize;
}
Impossible. It is possible with Javascript, or by putting only the first word within a span.
$('#INPUT_ID').keyup(function(){
if($(this).val().length>0 && $(this).val().length<5){
$(this).val($(this).val().charAt(0).toUpperCase()+$(this).val().substr(1));
}
});
Can't use length==1, as it doesn't work if user types fast.
JS: str.charAt(0).toUpperCase();