# Avoid "Enter" key on "search\_input"

**URL:** <https://community.hubspot.com/t/avoid-enter-key-on-search-input/42635>\
**Category:** CMS Development\
**Tags:** html\
**Created:** [August 20, 2021, 12:49pm UTC](https://community.hubspot.com/t/avoid-enter-key-on-search-input/42635 "2021-08-20T12:49:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SebastienR](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sebastienr/32/70293_2.png) [@SebastienR](https://community.hubspot.com/u/SebastienR)\
**Post date:** [August 20, 2021, 12:49pm UTC](https://community.hubspot.com/t/avoid-enter-key-on-search-input/42635/1 "2021-08-20T12:49:55Z")

</div>

Hi everyone,

Is there a way that if I put this code

```lia-code-sample
<div class="blog-search">
 {% module "search_input" path="@hubspot/search_input" %}
</div> 

```

I have no way to click the “enter” key so that redirect on the result list on another page BUT just be able to click on one of the result from the dropdown list?

many thanks by advance.

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [August 20, 2021, 1:52pm UTC](https://community.hubspot.com/t/avoid-enter-key-on-search-input/42635/2 "2021-08-20T13:52:57Z")

</div>

Just to be clear, you want to disable the “Enter” key on input so the user doesn’t get redirected to the results page, instead forcing them to click one of the suggestions?

You could do it with JS

```lia-code-sample
var input = document.getElementsByClassName('hs-search-field__input')[0];
input.addEventListener('keydown', function(e) {
 if (e.key == 'Enter') {
 e.preventDefault();
 }
});

```

---

<div class="post-metadata">

**Author:** ![SebastienR](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sebastienr/32/70293_2.png) [@SebastienR](https://community.hubspot.com/u/SebastienR)\
**Post date:** [August 20, 2021, 2:48pm UTC](https://community.hubspot.com/t/avoid-enter-key-on-search-input/42635/3 "2021-08-20T14:48:54Z")

</div>

Hi @piersg ,

Many thanks for this quick reaction 🙂

Yes, it’s exactly for that.

As I’m a noob, I will ask you if I must copy/paste this code [here](https://screenshots.onestock-retail.com/19/7428f149fd85b64545256b4e78dca8ae.png)?

Many thanks

---

<div class="post-metadata">

**Author:** ![SebastienR](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sebastienr/32/70293_2.png) [@SebastienR](https://community.hubspot.com/u/SebastienR)\
**Post date:** [August 20, 2021, 3:02pm UTC](https://community.hubspot.com/t/avoid-enter-key-on-search-input/42635/4 "2021-08-20T15:02:38Z")

</div>

Many thanks @piersg

That’s works exactly as expected 🙂
