2015-08-22 90 views
-1

此彈出類別的高度爲0.當按下按鈕時,我將增加高度100%。裏面有彈出包裝類別div在我的數據存儲。 也有用於用戶控件的div(關閉彈出窗口)。清除div的一部分

<div class="pop-up-category"> 
    <div class="pop-up-wrap-category"> 
    <p>clear just this content</p> 
//this this should be still visible(populated) 
    <div class="user-controls"> 
     <span class="close-popup btn btn-danger">Close</span> 
    </div> 
    </div> 
</div> 

JS:

$(document).on("click", ".close-popup", function() { 
     // console.log("sdasd"); 
     $('.pop-up-wrap-category').empty(); 
    }); 

如何清除彈出,包裝類,但用戶控件的內容仍停留可見?

回答

1

找到p和明確的p-

$(document).on("click", ".close-popup", function() { 
    // console.log("sdasd"); 
    $('.pop-up-wrap-category > p').empty(); //use .remove() if you want to get the p tag deleted from DOM 
}); 
+0

@ joyBlanks怎麼樣,如果我有

代替對? – LoverBugs

+0

'$('。pop-up-wrap-category> p,.pop-up-wrap-category> div.holder')'如果jquery發現一個'p'或'div.holder',它會清空那個 – joyBlanks