I want to make the ALPHABET capitalize entered by the user in the textbox if there is a space before it.
Example user writes "test new" so "n" should be a capital and it will be so smooth that it feels like the user pressed the shift key
I think we can do the same in keydown event (jquery)
The code is something that i tried is:
$('.name').live("keydown", function (e) {
try {
if ($('.name').val().length > 1) {
if ($('.name').val().substring($('.name').val().length - 1) == " ") {
// HERE can we do something like e.shift key etc to get desired result
}
}
} catch (err) {
alert(err);
}
});
Alternative
.name {
text-transform:capitalize;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With