在纯JavaScript中编写,如何将我创建的函数作为方法附加到dom选择器?
var button = document.getElementById('dropdown-trigger'),
dropdownList = document.getElementsByClassName('dropdown-list');
button.addEventListener('mouseover', displayDropdown);
function toggleClass(className) {
//toggle function here
}
function displayDropdown() {
// I want to do something like:
dropdownList.toggleClass('none')
};
感谢您的帮助!