diff --git a/lib/script.js b/lib/script.js index e69de29..ffda082 100644 --- a/lib/script.js +++ b/lib/script.js @@ -0,0 +1,15 @@ +const url = "https://api.thecatapi.com/v1/images/search" + +const button = document.querySelector(".randomButton") + +button.addEventListener("click", handleClick) + +function handleClick() { +fetch(url) + .then((res) => res.json()) + .then((data) => { + //console.log(data[0].url); + document.querySelector(".randomCat").innerHTML = `` + }) + .catch((err) => console.log("oops something went wrong", err)); +} \ No newline at end of file