algolia / algoliasearch-zendesk

Integrate Algolia within your Zendesk Help Center in minutes.
https://community.algolia.com/zendesk
Other
21 stars 12 forks source link

How can I disable the the return key on the search form? #72

Closed zeckdude closed 6 years ago

zeckdude commented 6 years ago

Is there any way i can disable having the return key submit the search form (that takes the user to the detailed search page)? I would like to force the user to select one of the options in the menu that opens when they type in keywords.

Is this possible already? Or will I need to add some JS to do this myself?

Jerska commented 6 years ago

This library doesn't provide anything to prevent this behavior, but fortunately is pretty easily achievable with some JavaScript.

https://stackoverflow.com/questions/8664486/javascript-code-to-stop-form-submission

$('fixme-form-selector').submit(function (evt) {
    evt.preventDefault();
});