我有一個div
與圖像。當我按鍵盤上的按鍵時,我想要隱藏這些圖像。我怎樣才能做到這一點?更改div內容和刷新div時按鍵盤鍵
<div>
<span role="checkbox" aria-checked="true" tabindex="0">
<img src="checked.gif" role="presentation" alt="" />
</span>
</div>
<div>
<span role="checkbox" aria-checked="true" tabindex="0">
<img src="checked.gif" role="presentation" alt="" />
</span>
</div>
<div>
<span role="checkbox" aria-checked="false" tabindex="0">
<img src="unchecked.gif" role="presentation" alt="" />
</span>
</div>
這是div
與內容。我想要在keypress
事件中隱藏這些圖像..!
用JavaScript – unconnected
需要Javascript爲。有多個問題應該可以幫助你解決你的問題。如[這個答案](https://stackoverflow.com/a/16089470/2412895)或[這個答案](https://stackoverflow.com/questions/2554149/html-javascript-change-div-content)等 – KarelG
HTML代表內容,CSS代表樣式,Javascript代表交互性。你有HTML,現在你需要Javascript。 – Clonkex