Tell us what’s happening:
I can’t seem to figure on what is incorrect in this portion of my code. I am stuck on the 4th step and it’s still not letting me pass the ‘Please enter a Vaild number’.
I have tried .textContent, .innerHTML, .innerText and still doesn’t seem to pass. What am i missing?
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>Roman Numeral Converter</title>
</head>
<body>
<input id="number">
<button id="convert-btn">Convert</button>
<div id="output"></div>
<script src="./script.js"></script>
</body>
</html>
/* file: styles.css */
/* file: script.js */
const inputBtn = document.getElementByID('number');
const convertBtn = document.getElementById('convert-btn');
const output = document.getElementById('output');
const numerals = {
1000: 'M',
900: 'CM',
500: 'D',
400: 'CD',
100: 'C',
90: 'XC',
50: 'L',
40: 'XL',
10: 'X',
9: 'IX',
5: 'V',
4: 'IV',
1: 'I'
};
convertBtn.addEventListener("click", () => {
if (inputBtn.value === "") {
output.textContent = "Please enter a valid number";
} else if (inputBtn.value <= -1) {
output.textContent = "Please enter a number greater than or equal to 1";
} else if (inputBtn.value >= 4000) {
output.textContent = "Please enter a number less than or equal to 3999";
}
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Challenge Information:
Build a Roman Numeral Converter Project - Build a Roman Numeral Converter