I have a modal input with 2 fields. One is the text input for the full name and the second is a disabled field to get the live result. The result is the Capitalized letter of each word in the input text field 1. I have no clue on how to go about doing this, any thoughts or ideas?
$(function() {
var $src = $('#inputClientName'),
$dst = $('#disabledinputClientCode');
$src.on('input', function() {
$dst.val($src.val());
});
});
//This is what I tested:
//match(/(\b\S)?/g).join("").toUpperCase()
This code lets me copy the input into the destination text block. I tried using the test code above and could not get the desired result. Please help.
You can use CSS to do that. There is a CSS prop: text-transform (docs here). When you add text-transform: capitalize; to the styling of the input it will capitalize each word. Now all you have to do is set the value of the first input to be equal to the value of the second input.