I'm using the following jQuery to capitalize the 1st letter of an input script.
$('li.capitalize input').keyup(function(event) {
var textBox = event.target;
var start = textBox.selectionStart;
var end = textBox.selectionEnd;
textBox.value = textBox.value.charAt(0).toUpperCase() + textBox.value.slice(1);
textBox.setSelectionRange(start, end);
});
In addition, I now need to capitalize a letter at a specific position (not the first letter) in a string comprising letters and numbers.
For example: Da1234Z I need to capitalize both D and Z.
How can I do this?