Javascript Converting < to HTML Code
-
I am having difficulty with the below Javascript, where < is getting converted to HTML code when loading in the browser.
I’ve tried putting the code into a separate .js file, but it still isn’t working, I’m guessing because it’s outside the loop.
<script> var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].onclick = function(){ this.classList.toggle("active"); this.nextElementSibling.classList.toggle("show"); } } </script>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Javascript Converting < to HTML Code’ is closed to new replies.