【发布时间】:2020-01-17 08:44:19
【问题描述】:
changeButton.className = 'change button types-popup';
const changePopup = document.createElement('div');
changeButton.appendChild(changePopup);
changeButton.onmouseover = e => {
if (!e.target.classList.contains('types-popup')) return;
changePopup.innerHTML = '':
renderTypes(changePopup, type => {
defectData.action = 'update';
defectData.type = type.id;
textDiv.children[0].innerText = type.description;
closePopups();
});
我完全不懂js。那么你能帮我把这个 onmouseover 改成 onclick 打开/关闭吗?谢谢!
【问题讨论】:
-
你尝试过什么吗?
-
changeButton.onclick不适合您? -
如果我只是更改为 onclick 它也会关闭 onclick 而无需任何其他操作?
-
你的意思是你想让它切换?你试过onclick吗?
标签: javascript button onclick mouseover