websieve/script.js

12 lines
453 B
JavaScript
Raw Normal View History

2024-10-21 17:14:14 -05:00
document.getElementById('calculateButton').addEventListener('click', () => {
const input = document.getElementById('siveInput').value;
const resultContainer = document.getElementById('resultContainer');
if (input) {
const primes = sive(input);
resultContainer.innerHTML = `<h2>Prime Numbers:</h2><p>${primes.join(', ')}</p>`;
} else {
resultContainer.innerHTML = `<p>Please enter a valid number.</p>`;
}
});