Skip to content

Commit

Permalink
#1243 Prevent ENTER in text input elements to trigger submit
Browse files Browse the repository at this point in the history
  • Loading branch information
j3nsch committed Oct 21, 2024
1 parent 9a5fccb commit ed281d8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions public/layouts/opus4/js/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @category Application
* @author Sascha Szott <[email protected]>
* @copyright Copyright (c) 2008-2012, OPUS 4 development team
* @copyright Copyright (c) 2008, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
* @version $Id$
*
*/

$(function () {
Expand All @@ -40,4 +36,12 @@ $(function () {
});
});

$('form').on('keydown', e => {
if (e.key === 'Enter') {
if ($(e.target).is("input[type='text']")) {
e.preventDefault();
}
}
});

});

0 comments on commit ed281d8

Please sign in to comment.