diff --git a/javascript/src/Alert.js b/javascript/src/Alert.js index 1168877f0f7804fa34f4afcc75dbc7d91a5ce3f2..10f48e736dd0f969723f552c5ea33e12ae8145a4 100644 --- a/javascript/src/Alert.js +++ b/javascript/src/Alert.js @@ -39,6 +39,7 @@ var QfqNS = QfqNS || {}; * * { * label: <button label>, + * focus: true | false, * eventName: <eventname> * } * @@ -139,8 +140,11 @@ var QfqNS = QfqNS || {}; $buttons = $("<div>").addClass("alert-buttons"); } - $buttons.append($("<a>").append(buttonConfiguration.label) - .addClass("btn btn-default") + var focus = buttonConfiguration.focus ? buttonConfiguration.focus : false; + + $buttons.append($("<button>").append(buttonConfiguration.label) + .attr('type', 'button') + .addClass("btn btn-default" + (focus ? " wants-focus" : "")) .click(buttonConfiguration, this.buttonHandler.bind(this))); } @@ -173,6 +177,7 @@ var QfqNS = QfqNS || {}; $alertContainer.append(this.$alertDiv); this.$alertDiv.slideDown(this.fadeInDuration, this.afterFadeIn.bind(this)); + this.$alertDiv.find(".wants-focus").focus(); this.shown = true;