我有以下结构:
<li id="0" class="instruction">
<div class="row1">
title
</div>
<div class="row2 details hidden">
details
</div>
</li>
隐藏的CSS是:display: none
我希望当用户单击指令时,然后显示详细信息 div。
$(document).ready(function () {
$(".instruction").click(function(e){
$(e).find('.details').removeClass("hidden");
});
});
尝试实现类似上面的东西,但不起作用。任何想法?
未回答,但供 Google 员工参考 -vanilla用于查找类和删除类的 Javascript 选项
// Finding all elements of a class (creates an array of results)
let x = document.getElementsByClassName("today");
// If it exists, remove it.
if(x.length > 0) { x[0].classList.remove("today"); }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)