我需要隱藏這些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