From 4522add764d9359d816c4b731666929e01d4dff9 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 21 May 2014 18:50:21 +0200 Subject: [PATCH] Only enable the add email button when input looks like an email address --- public/js/vroom.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index 737f406..71a5ab0 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -1275,10 +1275,9 @@ function initVroom(room) { }); // Add an email to be notified when someone joins - // First, enable the add button when you start typing - // TODO: should be enabled only when the input looks like an email address + // First, enable the add button when the input looks like an email address $('#newEmailNotification').on('input', function() { - if ($('#newEmailNotification').val() == ''){ + if (!$('#newEmailNotification').val().match(/^\S+\@\S+\.\S+$/)){ $('#newEmailNotificationButton').addClass('disabled'); } else{