Closed krishaamer closed 7 years ago
So if anyone has the same problem, what I ended up doing is faking the user with
$("#search").val("");
$('#search').focus();
$('#search').keydown();
$('#search').keypress();
$('#search').keyup();
$('#search').blur();
It works but is perhaps not the most elegant solution. So if you have something better, please do let me know below.
Cheers, -Kris
Hi kris
I'm sorry for the late answer, but probably you want to use the component methods? http://matteodem.github.io/meteor-easy-search/docs/components/. There's a method called search
, see the code for the input component https://github.com/matteodem/meteor-easy-search/blob/master/packages/easysearch:components/lib/input/input.js#L13.
Let me know if that's not what you were looking for.
Yes, that solved it! Thank you so much!
Thank you for the awesome package!
I'm using the search input in the header of the site where it's always visible. While the user is searching I hide the content using {{#EasySearch.IfInputEmpty}} to highlight the search results (which otherwise would be lower on the page below the content).
Now when the user clicks on one of the results the input is still populated with the search string so the new page content remains hidden.
How would be the best way to set the search string empty? Just setting the input element to undefined using $ doesn't work as {{#EasySearch.IfInputEmpty}} still seems to think there's content in the search field so the content remains hidden.
So how can we reset the search input?
Any advice would be appreciated.
Thanks, -Kris https://yah.haam.co/