From 1f5fe587f2b87d403195ab767e52ed00901a09cb Mon Sep 17 00:00:00 2001 From: Tom Price Date: Tue, 2 Dec 2014 00:19:41 +0000 Subject: [PATCH] Fixed glitch when setting autocomplete field to emtpy --- RIGS/static/js/autocompleter.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RIGS/static/js/autocompleter.js b/RIGS/static/js/autocompleter.js index 4a930274..d152febe 100644 --- a/RIGS/static/js/autocompleter.js +++ b/RIGS/static/js/autocompleter.js @@ -8,6 +8,7 @@ $(document).ready(function() { $(this).autocomplete({ source: source, minLength: 3, + delay: 500, focus: function(e, ui) { e.preventDefault(); $(this).val(ui.item.label); @@ -17,7 +18,12 @@ $(document).ready(function() { e.preventDefault(); $(this).val(ui.item.label); $("#"+$(this).data('target')).val(ui.item.value) - }, + } }); + $(this).on('blur', function () { + if ($(this).val() == "") { + $("#" + $(this).data('target')).val(''); + } + }) }); }); \ No newline at end of file