From 3df00e9e0e2ea629669a26199bfd941ba8402247 Mon Sep 17 00:00:00 2001 From: Ezequiel Bergamaschi Date: Sat, 8 Feb 2014 17:54:10 -0300 Subject: [PATCH] dialog modal with focus and submit on enter --- wise-webapp/src/main/webapp/js/mindmapList.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wise-webapp/src/main/webapp/js/mindmapList.js b/wise-webapp/src/main/webapp/js/mindmapList.js index 72c45f26..bda99ce4 100644 --- a/wise-webapp/src/main/webapp/js/mindmapList.js +++ b/wise-webapp/src/main/webapp/js/mindmapList.js @@ -164,7 +164,18 @@ jQuery.fn.dialogForm = function (options) { this.modal('hide'); }.bind(this)); + // Register enter input to submit... + $("input").keypress(function(event) { + if (event.which == 13) { + event.preventDefault(); + acceptBtn.trigger('click'); + } + }); + // Open the modal dialog ... + this.on('shown', function() { + $('#' + containerId + ' input:first').focus(); + }); this.modal(); };