diff --git a/lib/script.js b/lib/script.js index e69de29..007c6a9 100644 --- a/lib/script.js +++ b/lib/script.js @@ -0,0 +1,18 @@ +const url = "https://api.thecatapi.com/v1/images/search"; + +const buttonForCat = document.querySelector(".randomButton"); + +const catImage = document.querySelector('.randomCat') + +buttonForCat.addEventListener('click', theClick) + + +function theClick() { + fetch(url) + .then((res) => res.json()) + .then((data) => { + // console.log(data[0]); + catImage.innerHTML = `` + }) + .catch((err) => console.log("oops something went wrong")); +}