Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  
  <input type="text">
</body>
</html>
 
span {
  display: block;
  margin-top: 10px;
}
 
$('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);
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
tsmpro
0viewers