# Can an input bar with corvid code be added to the header to work on all pages?

**URL:** <https://forum.wixstudio.com/t/can-an-input-bar-with-corvid-code-be-added-to-the-header-to-work-on-all-pages/4332>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [January 25, 2021, 10:02am UTC](https://forum.wixstudio.com/t/can-an-input-bar-with-corvid-code-be-added-to-the-header-to-work-on-all-pages/4332 "2021-01-25T10:02:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![payment](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/payment/32/18119_2.png) [@payment](https://forum.wixstudio.com/u/payment)\
**Post date:** [January 25, 2021, 10:02am UTC](https://forum.wixstudio.com/t/can-an-input-bar-with-corvid-code-be-added-to-the-header-to-work-on-all-pages/4332/1 "2021-01-25T10:02:41Z")

</div>

Hi guys, hope you are all safe. I was looking for some advice on working with the header section of my site using a search function I made using this video: [https://www.youtube.com/watch?v=ZiKcx2nlrkw](https://www.youtube.com/watch?v=ZiKcx2nlrkw)

I have the search working on my homepage which directs to a search results page, but thought it would be ideal to have it in the header so that it shows on all of my 500+ site pages. I’m not bothered about showing results in a repeater on every page. I just want it so that if someone searches in the input bar at the top of the site it takes them to my search results page. I have seen you can add code to the Head section of your site but it’s not the same as the corvid panel so don’t know if it’s possible.

If not I’ll just have to manually add the search to all my pages which will take ages.  
Matt

---

<div class="post-metadata">

**Author:** ![anon72313111](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@anon72313111](https://forum.wixstudio.com/u/anon72313111)\
**Post date:** [January 25, 2021, 10:22am UTC](https://forum.wixstudio.com/t/can-an-input-bar-with-corvid-code-be-added-to-the-header-to-work-on-all-pages/4332/2 "2021-01-25T10:22:52Z")

</div>

Hi there …

Short answer, Yes. You can add almost anything to the header.

---

<div class="post-metadata">

**Author:** ![payment](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/payment/32/18119_2.png) [@payment](https://forum.wixstudio.com/u/payment)\
**Post date:** [January 25, 2021, 10:36am UTC](https://forum.wixstudio.com/t/can-an-input-bar-with-corvid-code-be-added-to-the-header-to-work-on-all-pages/4332/3 "2021-01-25T10:36:47Z")

</div>

That’s great news!

So I dragged and dropped the search bar into the Header. I then created a new “custom code” for the header section and then copied and pasted the below code from the homepage but nothing happens after searching. I think it’s the click event and keypress events…

**import** {local} **from** ‘wix-storage’ ;

**import** wixLocation **from** ‘wix-location’ ;

$w.onReady( **function** () {

});

export function searchButton\_click\_1() {

**let** word = $w( “#searchBar” ).value;

```
local.setItem( "searchWord" , word); 

wixLocation.to(`/ **new** -search`); 

```

}

export function searchBar\_keyPress\_1(event) {  
**if** (event.key === “Enter” ) {

**let** word = $w( “#searchBar” ).value;

```
local.setItem( "searchWord" , word);  

wixLocation.to(`/ **new** -search`);  

```

}  
}

---

<div class="post-metadata">

**Author:** ![anon72313111](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@anon72313111](https://forum.wixstudio.com/u/anon72313111)\
**Post date:** [January 25, 2021, 10:40am UTC](https://forum.wixstudio.com/t/can-an-input-bar-with-corvid-code-be-added-to-the-header-to-work-on-all-pages/4332/4 "2021-01-25T10:40:51Z")

</div>

@payment You need to put the code in the **masterPage.js** file, and make sure the events are active in the properties panel.

---

<div class="post-metadata">

**Author:** ![payment](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/payment/32/18119_2.png) [@payment](https://forum.wixstudio.com/u/payment)\
**Post date:** [January 25, 2021, 4:01pm UTC](https://forum.wixstudio.com/t/can-an-input-bar-with-corvid-code-be-added-to-the-header-to-work-on-all-pages/4332/5 "2021-01-25T16:01:18Z")

</div>

Thanks @ahmadnasriya I got it to work. It’s a bit slow and for some reason only works once. I will have a play with it and see how things go.

---

<div class="post-metadata">

**Author:** ![anon72313111](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@anon72313111](https://forum.wixstudio.com/u/anon72313111)\
**Post date:** [January 25, 2021, 4:42pm UTC](https://forum.wixstudio.com/t/can-an-input-bar-with-corvid-code-be-added-to-the-header-to-work-on-all-pages/4332/6 "2021-01-25T16:42:59Z")

</div>

Let me know how it goes.
