document.addEventListener("DOMContentLoaded", function() { const linkInput =…
- User
document.addEventListener("DOMContentLoaded", function() { const linkInput = document.getElementById("linkInput"); const checkButton = document.getElementById("checkButton"); let checkingLink = false; // Ignored setInterval(() => { if (linkInput.value != "") { checkButton.disabled = false; } else { checkButton.disabled = true; } }, 16); }); Doesn't work
- Assistant
It looks like you are trying to enable or disable a button based on whether an input field has text in it using JavaScript. The code snippet you provided should work correctly to enable and disable the button as expected.
However, there are a few points to consider that might be causing issues:
-
Make sure the HTML elements exist: Ensure that there are elements with the IDs and in your HTML.
-