title: Convert first letter to uppercase on input box
body: <p><a href="https://jsbin.com/dopika/4/edit?js,console,output" rel="noreferrer">JS Bin demo</a></p>
  
  <p>This <a href="http://regexr.com/3cfmd" rel="noreferrer">regex</a> transform each lower case word to upper case. I have a full name input field. I do want the user to see that each word's first letter he/she pressed is converted to uppercase in the input field.</p>
  
  <p>I have no idea how to properly replace the selected characters in the current input field.</p>
  
  <pre><code>$('input').on('keypress', function(event) {
    var $this = $(this),
        val = $this.val(),
        regex = /\b[a-z]/g;
  
    val = val.toLowerCase().replace(regex, function(letter) {
      return letter.toUpperCase();
    });
  
    // I want this value to be in the input field.
    console.log(val);
  });
  </code></pre>