[英]make a link that when clicked disappear and show a div instead
How would I use javascript to make a link that, when clicked, disappears and in its place a hidden div appears? 我如何使用javascript制作一个链接,当点击时,消失并在其位置出现隐藏的div?
I am hoping for something like this: 我希望这样的事情:
[link]
<div id="hidden" style="hidden">
//hidden content
</div>
and when you click the link the div turns to "style='show'" and the link disappears. 当你点击链接时,div变成“style ='show'”,链接就会消失。
I hope this makes sense... 我希望这是有道理的...
Thanks in advance 提前致谢
In simple terms wihout using libraries: 简单来说,没有使用库:
<a href="javascript:void(0)" onclick="this.style.display = 'none'; document.getElementById('hidden').style.display = 'block'">Click me</a>
<div id="hidden" style="display: none">...</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.