Skip to content

Instantly share code, notes, and snippets.

Created January 27, 2013 22:23
Show Gist options
  • Save anonymous/4650951 to your computer and use it in GitHub Desktop.
Save anonymous/4650951 to your computer and use it in GitHub Desktop.
function buildButtons(buttons, fnResponse){
for (i = 0; i < buttons.length; i++){
initButton(buttons[i]);
}
}
function initButton(button) {
var btnTitle = button.split("|")[0];
var btnName = button.split("|")[1].toString();
var btnElem = $('<button/>', {
type: 'button',
id: 'btn_' + btnName,
html: btnTitle,
})
$(btnElem).on('click', function () {
//..some other code
fnResponse(btnName); //<<------- Issue Should return 'ok' or 'cancel'
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment