From 6b57bb2bbb9aeead0317ae1d6831abd7447cfac5 Mon Sep 17 00:00:00 2001 From: Pierre Bondoerffer Date: Thu, 13 Apr 2017 17:09:31 +0200 Subject: [PATCH] poll: press enter to validate input --- www/poll/main.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/www/poll/main.js b/www/poll/main.js index dca194717..2573a4f05 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -285,7 +285,7 @@ define([ }; /* Called whenever an event is fired on an input element */ - var handleInput = function (input) { + var handleInput = function (input, isKeyup) { var type = input.type.toLowerCase(); var id = getRealtimeId(input); @@ -363,8 +363,8 @@ define([ } }; - var hideInputs = function (e) { - if ($(e.target).is('[type="text"]')) { + var hideInputs = function (e, isKeyup) { + if (!isKeyup && $(e.target).is('[type="text"]')) { return; } $('.lock[data-rt-id!="' + APP.userid + '"]').html(lockHTML); @@ -397,10 +397,11 @@ define([ switch (nodeName) { case 'INPUT': + if (isKeyup && (e.keyCode === 13 || e.keyCode === 27)) { + hideInputs(e, isKeyup); + return; + } handleInput(target); - //if (isKeyup && (e.keyCode === 13 || e.keyCode === 27)) { - //hideInputs(e, isKeyup); - //} break; case 'SPAN': //case 'LABEL':