From 1706beeb721dc28a7b851cf34a05d2fb81eebc83 Mon Sep 17 00:00:00 2001 From: William Boman Date: Tue, 9 Dec 2014 19:17:31 +0100 Subject: [PATCH] Fix search input hint not clearing properly. --- src/_includes/icons/filter.html | 4 ++-- src/assets/js/site.js | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/_includes/icons/filter.html b/src/_includes/icons/filter.html index a41157963..bf656f4ad 100644 --- a/src/_includes/icons/filter.html +++ b/src/_includes/icons/filter.html @@ -5,10 +5,10 @@ <{% if page.navbar_active == "icons" %}div{% else %}section{% endif %} id="filter"> diff --git a/src/assets/js/site.js b/src/assets/js/site.js index 38b6eb07b..3254a0282 100644 --- a/src/assets/js/site.js +++ b/src/assets/js/site.js @@ -21,13 +21,19 @@ $(function() { arrowKeys: true }); - $clear.click(function(e) { + $clear.on('click', function(e) { e.preventDefault(); - $filter_by.val('').trigger('keyup').focus(); + $filter_by + .val('') + .trigger('input') + .trigger('keyup') + .focus(); + + $clear.addClass('gone'); // Hide clear button }); - $filter_by.keyup(function() { + $filter_by.on('keyup', function() { var $this = $(this); var val = $this.val().toLowerCase(); $filter.toggle(!!val); @@ -57,7 +63,7 @@ $(function() { } else { $no_results.hide(); } - }).trigger('keyup'); + }); } function inFilter(val, filter) {