-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmeme.js
More file actions
18 lines (15 loc) · 664 Bytes
/
Copy pathmeme.js
File metadata and controls
18 lines (15 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const btn = document.querySelector('.meme_gene .gene_meme_btn');
const img = document.querySelector('.meme_gene img');
const memetitle = document.querySelector('.meme_gene .meme_title');
const memeauthor = document.querySelector('.meme_gene .author');
const updateDetails = (url,title,author) => {
img.setAttribute("src",url);
memetitle.innerHTML = title;
memeauthor.innerHTML = `Meme by: ${author}`;
}
const generateMeme = () => {
fetch("https://meme-api.com/gimme/wholesomememes").then((response) => response.json()).then(data => {
updateDetails(data.url,data.title,data.author);
})
};
btn.addEventListener('click', generateMeme);