title: Changing the addClass in a javascript function to be called twice
body: <p>I have the function below:</p>
  
  <pre><code>var players = function(){
    var $div = $('&lt;div&gt;').attr('id', 'prompt');
    var $input = $('&lt;input&gt;').attr('class', 'player' + playerNames);
    var $p = $('&lt;p&gt;').attr('class', 'player' + playerNames).html("Enter First Player" );
    $div.append($input).append($p);
    $('.container').append($div);
  
    $('input').keydown(function(e) { 
      if(e.keyCode === 13) {
        $div.addClass('move-left').removeAttr('id');
        playerOne = $input.val();
        $p.html($input.val())
        $input.remove();
      }
    });
  }
  </code></pre>
  
  <p>I want to call this function twice in a row.</p>
  
  <p>I want the <code>.addClass('move-left')</code> to be <code>addClass('move-right')</code> playerNames which <code>starts at 0 to be 1</code> and finally for the "<em>Enter First Player</em>" to be "Enter Second Player". </p>
  
  <p>Do I need a <code>for</code>? 
  if so does it have to wrap the entire <em>function</em>? </p>
  
  <p>Thanks!   </p>