Skip to content

Instantly share code, notes, and snippets.

@pareshchouhan
Created June 22, 2014 14:58
Show Gist options
  • Save pareshchouhan/49028de0d82dbe51d3ca to your computer and use it in GitHub Desktop.
Save pareshchouhan/49028de0d82dbe51d3ca to your computer and use it in GitHub Desktop.
$('#nick').keypress(function(event){
if ( event.which == 13 ) {
var nick = $(this).val();
if (nick == '')
$(this).val('YOLO' + parseInt(Math.random() * 100 + 0 ));
nick = $(this).val();
client.name = nick;
$('#nickname').css('visibility','hidden');
$('form').css('visibility','visible');
$('#nick').unbind('keypress');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment