how do i make my nested drop down menu in the first button drop down
i copy pasted this code
for (var i = 0;i<this.children.length;i++){
if (this.children[i].classList.contains(‘dropdown-selection’)){
activeDropdown.id = this.id;
activeDropdown.element = this.children[i];
this.children[i].classList.add(‘active’);
}
//adding the dropdown-button to our object
else if (this.children[i].classList.contains(‘dropdown-button’)){
activeDropdown.button = this.children[i];
}
}
}
but it didnt work infact the 2 main buttons stopped working as well
Sorry no one answered. I wasn’t able to get yours to work without disassembling it completely (new to web dev). But I would look here and use it as a model:
https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_ref_js_dropdown_multilevel_css&stacked=h
1 Like
seen this before its different than mine
its more i think jquerry
but thanks anyways
The jquery just has to do with the click handler, not the formation of the nested dropdowns - the lines in the JS with “$” in them are jquery. If you fear jquery, then you can write and event handler in standard JS. But jquery is awesome and can be a huge timesaver - check it out.
1 Like