I have a div that has notes within it (each note has a title and content). When creating a new note, it gets its own title and content added into this div.
<div class="notes-list">
<h4 class="note-title">Title</h4>
<input class="note-content">Note content</input>
</div>
How can I make the input hide/show when I click on the title related to it?
const titles = document.querySelectorAll(".note-title");
const noteContent = document.querySelectorAll(".note-content");
titles.forEach(function(title) {
title.addEventListener("click", () => {
// unsure how to select the corresponding input related to the title:
noteContent.style.display = "inline-block";
});
});