Describe your issue in detail here.
I have been stumped on the beginning for hours and I can’t seem to figure this step out " hen you click on the #check-btn element without entering a value into the #text-input element, an alert should appear with the text Please input a value ."
Any learning tips on what I am doing wrong, so I can avoid this in the future?
ah thanks for pointing those out. I actually knew about those two points but I missed updating them in the numerous edits I’ve done to this code. The alert not appearing still is a brick wall for me
const textInput = document.querySelector('#text-input');
const checkbtn = document.querySelector('#check-btn');
checkbtn.addEventListener('click', novalue);
function novalue () { if (textInput.innerContent == '', alert('Please input a value')
) ;}
const alphanumericOnly = str.toLowerCase()
Challenge step that teaches the importance of script location
In real code (not the fCC editor) you can also use the defer or async attributes on the script element or turn it into a module using type="module" all of which will allow the script element (when loading a file) to be placed before the page content the code inside it is interacting with.
Without that, or when the script element is not placed after the content, the script can not have code that tries to interact with page content before that content has finished loading.
This step is still giving me issues even though I received the checkmark for it. Even when their is text and I click the submit button, the alert appears on screen.
I tried textInput.innerContent, .textInput.innerText, and textInput.innerHTML to make sure its vhecking if the text section is empty and not targeting something else, but when I try to move on to the next step by entering ‘A’, the alert still appears