2012-08-29 41 views
1
<script type="text/javascript"> 
    var product_features = ['draggable','trackable','colorable']; 

$(document).ready(function() { 

$('div#input .feature draggable').remove(); 
}); 

div標籤+ jquery的下卸下類屬性

<h3>Input</h3> 
<div id="input"> 
    <div class="feature draggable">Drag 1</div> 
    <div class="feature resizable">Resize</div> 
    <div class="feature downloadable">Download</div> 
    <div class="feature draggable">Drag 2</div> 
    <div class="feature trackable">Track</div> 
    <div class="feature colorable">Color</div> 
</div> 

<h3>Output</h3> 
<div id="output"></div> 

無法移除一個div類元件與特徵可拖動

 $('div#input .feature draggable').remove(); 

似乎這部分代碼有問題,請問這裏有什麼問題嗎?

JS小提琴:http://jsfiddle.net/9CzMG/47/

+2

'draggable'是一個類,不是功能! – adeneo

+0

我想刪除類名稱的元素:可拖動,我怎麼能這樣做? – KAPILP

+0

如何嘗試下面的一個很好的答案? – adeneo

回答

3

我認爲你需要,

$('div#input .feature.draggable').remove(); 
1

您可以使用這樣

 $('div#input .draggable').remove();