Junior
Why can't we access the element in the input?
sobes.tech AI
Answer from AI
Access to the content of an <input> element is done through its value property, not through textContent or innerHTML, because <input> is a form element intended for user data input, and its current value is stored in value.
// Accessing the input element
const inputElement = document.getElementById('myInput');
// Getting the value from input
const inputValue = inputElement.value;
// Setting the value in input
inputElement.value = 'New value';