+ 3
Using JavaScript to remove comment tags
Is it possible to remove HTML or CSS comment tags using JavaScript For example making it so when a button is clicked , a bunch of new code appear by removing the comment tags
4 Answers
+ 7
Yes, it's possible.
https://code.sololearn.com/WhCjvxtcoTcp/?ref=app
+ 7
Possible. Just use regex, replace every instance of /<!--(.|\n)*-->/g with "". That said, your JS will need to read your HTML file to do that. Not sure how that works on Code Playground.
+ 3
What I can understand is all you need to dynamically change the content of the page like adding something after clicking or removing like that. There are many ways you can do depending upon what exactly you want to do. One option would be, create the element in js and add it to web page dynamically or similarly can be removed as well. Or, can create it already in html with display =none and change it in js as needed.
- 1
Yes it is possible