12345678910111213141516171819202122232425262728 |
- var toggler = document.getElementsByClassName("caret");
- var i;
- for (i = 0; i < toggler.length; i++) {
- toggler[i].addEventListener("click", function() {
- this.parentElement.querySelector(".nested").classList.toggle("active");
- this.classList.toggle("caret-down");
- });
- }
- const elems = document.querySelectorAll("#myUL li span");
- var k=0;
- for (k; k<elems.length; k++) {
- elems[k].addEventListener('click', function() {
- console.log(this);
- document.querySelectorAll("#myUL li span").forEach(a=>a.style.color = "black");
- this.style.color = 'red';
- });
- }
- function showResult(showClass) {
- var cc = "." + showClass;
- document.querySelectorAll(".res").forEach(a=>a.style.display = "none");
- document.querySelectorAll(cc).forEach(a=>a.style.display = "block");
- }
|