so I'm trying to create a working comment section for a project. It doesn't need to be on bootstrap or still be there when refreshed, I just want to make it work. I feel like I'm close on figuring this out but there is something wrong on my code (as what the console log says). Please, I really need help :( Here's my javascript.
let commentSection = (event) => {
let $addComment = document.querySelectorAll('.addComment')
let $commentText = document.querySelectorAll('.comments')
let $commentList = document.querySelectorAll('.commentList')
let commentPost = commentText.value.trim();
document.querySelectorAll('.commentList').innerHTML = `
<li> Comment for the day: ${commentPost} </li>`
}
document.getElementById(`addComment`).addEventListener('click', commentSection);
and my HTML:
<div class="comment" id="comment">
<form>
<label for="comment"></label>
<textarea class="comments" placeholder="Let us know what you think!" name="comments" id="comments"></textarea>
</form>
<button class="addComment" id="addComment"> COMMENT </button>
</div>
<div class="commList">
<ul class="commentList" id="commentList"></ul>
</div>
console log on chrome says that there is something wrong on this part
let commentPost = commentText.value.trim();
I would appreciate any sort of help! Thank you