Elatteria-Website/E-Cafe Website/Scripts/flagle.js

24 lines
564 B
JavaScript
Raw Normal View History

2022-12-20 18:21:34 +02:00
async function getFlag() {
const getFlag = await fetch('https://flagcdn.com/en/codes.json')
const flag = await getFlag.json();
var inputField = document.getElementById("guessInput").value.toLowerCase();
document.getElementsByClassName("gamedle-section").innerHTML = guessInput;
if (inputField != flag.us.toLowerCase()) {
document.getElementById("guessInput").value=null;
window.alert("Wrong country!");
}
else {
document.getElementById("guessInput").value=null;
window.alert("Correct!")
}
}