I try to set some Javascript control over search input but how to manage in the correct way.
As I understand it is executed search event if there is any value but how to detect value and empty value but spaces should be detected due to spam. Due to usability it should be released search even empty field and show up categories.
PHP can manage this but can be also using Parsley validation?
Are you planning to use PHP to sanitize and validate the search-control values?
I find that JS is a bad choice for that, as you can never trust that JS has done anything.