I'm looking to create a Chrome extension for a new tab page. I've written the page and have it working only I'm having a problem with moving my Javascript from inline to external.

Current index.html is looking like this:

```
<script>
function process()
{
var url="https://www.google.co.uk/search?q=" + document.getElementById("goog").value;
location.href=url;
return false;
}
</script>

<div class="container">
    <form onSubmit="return process();">
        <input type="text" class="form-control" id="goog" placeholder="Google Search">
        <input type="submit" style="display:none"/>
    </form>

```

I've tried a few different methods of moving this into an external file but I'm not great with Javascript. I'd imagine I would need to use an event listener of some kind. I've tried placing this in search.js:

```
var form = document.getElementById("search");
form.addEventListener("submit", function() {
    var url="https://www.google.co.uk/search?q=" + document.getElementById("goog").value;
    location.href=url;
    return false;
});

```

With this amended html:

```
<form id="search">
    <input type="text" class="form-control" id="goog" placeholder="Google Search">
    <input type="submit" style="display:none"/>
</form>

```

But to no avail. Can anyone help?