My HTML page contains numerous comments enclosed in blockquotes.
I attempted to implement a feature that allows users to hide all the comments with just one click by using the following JavaScript code:
const blockQuotes = document.getElementsByTagName('blockquote'); for (let i = 0; i < blockQuotes.length; i++) { blockQuotes[i].style.display = 'none'; }
The functionality works as expected, but now I am facing an issue where the blockquote elements were acting as newlines. Consequently, when I hide the blockquote elements, there are no longer any newlines present.
Is there a way to hide the blockquotes and replace them with a newline? It is important that this action does not involve deleting the text within the blockquotes, as it needs to serve as a toggle for showing or hiding comments.