From 6767bd87df49a6eb66214ddb99b6db7d413066b6 Mon Sep 17 00:00:00 2001 From: Mike Young Date: Sun, 15 Dec 2019 22:53:56 -0500 Subject: [PATCH] added enter key event handler for searching --- src/interface/static/js/pyshelf_ux.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/interface/static/js/pyshelf_ux.js b/src/interface/static/js/pyshelf_ux.js index f846b49..fcadd24 100644 --- a/src/interface/static/js/pyshelf_ux.js +++ b/src/interface/static/js/pyshelf_ux.js @@ -4,4 +4,12 @@ $(document).ready(function(){ console.log(query); window.location.href = '/search/'+query; }) + $('.nav_search').on('keypress', function (e) { + if(e.which === 13){ + $(this).attr("disabled", "disabled"); + var query = $('.nav_search').val(); + window.location.href = '/search/'+query; + $(this).removeAttr("disabled"); + } + }); })