Tell us what’s happening:
I am pretty sure that I got the code for the alert function correct, but it doesn’t work. Could someone please tell me what I am doing wrong?
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>document</title>
</head>
<body>
<input id="text-input">
<button id="check-btn">Check</button>
<div id="result"></div>
<script scr="script.js"></script>
</body>
</html>
/* file: styles.css */
/* file: script.js */
const input = document.getElementById("text-input");
const check = document.getElementById("check-btn");
const result = document.getElementById("result");
check.addEventListener("click",() => {
if(input.value === ""){
alert("Please input a value")
}
})
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker