Question: New to javascript and just trying to make a simple form validation where if the user/pass is valid the box border turns green, and if invalid, it turns red (pictured) [Valid/Invalid](https://i.stack.imgur.com/Qlmd0.png) 

Here is my HTML: (Form Works, I'm guessing I'm screwing up on the listeners and Handlers)

```
<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  <input type="text" name="username" value="Username" minLength="6" maxlength="10" required>
  <br><br>
  <input type="text" name="password" value="Password" minLength="8" maxlength="15" required>
  <br><br>
  <input type="submit" value="Submit" onclick="function(changeStyle)">
</form> 

<script src="Script1.js">
</script>

</body>
</html>

```

Javascript:

```
function valid() {
  var textElements = document.getElementsByTagName('input');
    textElements[i].addEventListener('input', function(changeStyle) {
    if (event.target.validity.valid) {
        textElements[i].style.border = "solid green 2px";
        textElements[i].style.boxShadow = "0 0 5px green";
    } else {
        textElements[i].style.border = "solid red 2px";
        textElements[i].style.boxShadow = "0 0 5px red";
    }
}, false);

}

</script>

```

Answer: 
Put your Api key in url like 

"<https://www.googleapis.com/youtube/v3/search?key=YOUR_API_KEY>"

```
axios.get("https://www.googleapis.com/youtube/v3/search?key=Your_Api_Key", {
          params: {
            type: "video",
            part: "snippet",
            q: searchTerm
          }
        })
        .then(response => console.log(response));

```

You will find an example as well [here](https://developers.google.com/youtube/v3/getting-started)
Solved this by configure/updating/enabling the settings.

The api key worked in the past for me. When returning to use it again, i received a 403 error.

The server understood my request, but denied me access to the info.

Just go into developers console, go to enable apis, search youtube, and enable it, your key will now work as expected.

[![enter image description here](https://i.stack.imgur.com/RQrDS.png)](https://i.stack.imgur.com/RQrDS.png)