refactored code for location input

refactored code
- clicking the search icon, or pressing enter call the same function.
- clears input box on submit