我需要隐藏这些divs点击button
在另一个div
如下所示。当我在另一个div
中点击button
时,它隐藏了另一个div
和相反。切换div
<!DOCTYPE html>
<html lang="en">
<head>
<title>
tesing hide
</title>
<style>
#ticket, #usernamepassword { margin-top: 20px; width: 960px; color: navy; background-color: pink; border: 2px solid blue; padding: 5px; text-align: center; }
</style>
</head>
<center>
<div id="ticket">
<div> this is the content of my ticket div
</div>
<button>Show usernamepassword</button>
</div>
<div id="usernamepassword">
<div> this is the content of username and password div</div>
<button>Show ticket</button>
</div>
</center>
</html>
欢迎堆栈溢出。在这里,我们希望人们在寻求帮助之前做一些[研究](https://stackoverflow.com/search?q=toggle+divs)。另外,我建议你阅读[如何提出一个好问题](https://stackoverflow.com/help/how-to-ask) – Tijmen
请你考虑接受答案吗? – DimitrisCSD