刪除一個div我有它的HTML看起來像一個形式:jQuery的 - 從形式
<div id="form_container">
<h1><a>Untitled Form</a></h1>
<form action="save_form" method="post" id="newform" name="newform">
<div class="form_description">
<h2 class="editable">Form title. Click here to edit</h2>
<p class="editable">This is your form description. Click here to edit.</p>
</div>
<ul id="form_body">
<li id="field1" class="world">
<a href="#" onclick="return false;" class="hover">
<label class="editable" for="field1">Text1</label>
<input type="text" name="field1" value=""></a>
<div class="element_actions">
<img src="/images/ico_delete_16.png" alt="Delete." title="Delete" class="remove_element">
</div>
</li>
</ul>
</form>
</div>
我想克隆形式,並從中取出「element_actions」 DIV。我不想修改現有的表單,只是它的克隆版本。
我試過'remove()'和'detach'沒有成功。
下面是對的jsfiddle測試:http://jsfiddle.net/truthseeker/LYCkt/
感謝您的幫助。
您可以按 「TidyUp」 按鈕。它正確縮進代碼,使其更易於閱讀。 ':)' –
抱歉。 – truthSeekr
沒問題':p' –