我想刪除裏面的div和內容,當我點擊左下角的刪除圖標。我將如何能夠做到這一點?當點擊X時,問題的內容和div將消失。刪除內容(DIV)通過點擊刪除按鈕
這是代碼。
<li class="question" id="question2">
<div class="question-header curves dense-shadows">
What color is the sky?
</div>
<div class="question-content dense-shadows">
<ol type="A">
<li><input type="radio" id="q2a1" name="question2" /> Red</li>
<li><input type="radio" id="q2a2" name="question2" /> Green</li>
<li><input type="radio" id="q2a3" name="question2" /> Blue</li>
<li><input type="radio" id="q2a4" name="question2" /> Brown</li>
</ol>
<div style="text-align:right">
<a href="#" class="delete"><span style="margin-left:5px;"><img src="images/deletebutton.png"
onmouseover="this.src='images/deletebuttonhover.png'" onmouseout="this.src='images/deletebutton.png'" title="Delete" alt="delete"/></span></a>
</div>
</div>
</li>
你有什麼編碼? – gezzuzz
@gezzuzz我這樣做,但它只是顯示爲格式。 – user2626071
找到父項,然後使用['removeChild'](https://developer.mozilla.org/en-US/docs/Web/API/Node.removeChild) – bfavaretto