title: dynamically create user name
body: <p>I want to create a username based on the name of a person with jquery.</p>
  
  <p>I have no idea how to start, I was thinking about split the name, get the first letter from each part and concatenate with the last name. But I don't know how to do it if the name has lots of words.</p>
  
  <p>For example my name </p>
  
  <pre><code>'First' -&gt; username 'first'
  'First Second' -&gt; username 'fsecond'
  'First Second Third' -&gt; username 'fsthird'
  </code></pre>
  
  <p>code (only do the first case, but what if there are many middle name?)</p>
  
  <pre><code>function createUsername(fullName) {
  
     var piece;
     var size;
  
     piece = fullName.split(' ');
     size = piece.length;
     if(size == 1)
       $("#userName").val(piece[0]);
  }
  
  
  &lt;input type='text' onKeyUp = 'createUsername(this.value)'/&gt;
  &lt;input type='text' name='userName' id='userName' /&gt;
  </code></pre>