如果存在,我需要刪除容器中的特定元素。下面的代碼提醒告訴我該元素存在,但無論出於何種原因,都不會刪除,並且不會提供任何錯誤消息。JQuery語法 - remove()將無法在元素上工作
var second_page_item = $('DIV#discount_0 > .element .first_static .second_page .isotope-item');
if($(second_page_item).length == 0) {
alert('it here');
$(second_page_item).remove(); //WHY DOESNT IT REMOVE?
}
如果長度等於零,你要刪除什麼? –
奇怪的問題... –
如何顯示警報? – giammin