Skip to content

Instantly share code, notes, and snippets.

@tstone
Created November 20, 2009 21:23
Show Gist options
  • Save tstone/239795 to your computer and use it in GitHub Desktop.
Save tstone/239795 to your computer and use it in GitHub Desktop.
// When the toolbar button is clicked...
$('#newNickButton').click(function() {
var newNick = getNewNickname();
setNewNickname(newNick);
}
function getNewNickname() {
// Build dialog markup
var win = $('<div><p>Enter your new nickname</p></div>');
var userInput = $('<input type="text" style="width:100%"></input>');
userInput.appendTo(win);
var userValue = '';
// Display dialog
$(win).dialog({
'modal': true,
'buttons': {
'Ok': function() {
userValue = $(userInput).val();
$(this).dialog('close');
},
'Cancel': function() {
$(this).dialog('close');
}
}
});
// Wait until dialog is closed !?!?!?
// How do we do this!? OH NOES!?!
return userValue;
}
function setNewNickname(nick) {
// Do whatever...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment