I can access elements but not it’s text by textContent or innerText [closed]
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
let submit1 = document.getElementById(‘submit1’);
function display() {
alert(word1.textContent);
alert(word1.innertext);
alert(word1);
}
submit1.addEventListener(‘click’, display, false);
<div class=”container”>
<input id=”word1″ type=”text” name=”word1″>
<input id=”submit1″ type=”submit” name=”submit” value=”check”>
</div>
Why can’t I access text from elements?
I have used textContent so many times earlier this the first I have encountered such bug
أضف إجابة