Fixed global search field, will search when a dropdown item is clicked

I came across JS errors when looking at the global search and fixed broken code.