The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Help w/ Running Multiple Javascripts Reply To: Help w/ Running Multiple Javascripts


Hey! I’ve researched this a bit more but still can’t seem to make it work as I can’t find a clear tutorial on how to do it properly. I’ve attempted the DomContentLoaded event listener but my collapsible content still won’t work. Sorry, I’m a complete wreck when it comes to coding ahah

Would you be able to help me figure out how to write it specifically? Because this is what I’ve done, and I think there’s something still missing. Thanks in advance!

            var coll = document.getElementsByClassName("collapsible");
            var i;

            for (i = 0; i < coll.length; i++) {
            coll[i].addEventListener ("DOMContentLoaded", ready) ("click", function() {
                var content = this.nextElementSibling;
                if ({
       = null;
                } else {
       = content.scrollHeight + "px";