2015-04-08 148 views
0

「刪除」不工作&無法刪除POP_UP窗口遺漏的類型錯誤:無法讀取屬性未定義

function add_comm(){ 
if($("#fio").val().length>0&&$("#ms_comment").val().length>0){ 
    $.post('/send.php',{subject:"Комент",message:"FIO: "+$("#fio").val()+"<br /> Comment: "+$("#ms_comment").val()+"<br>"}); 
    $(".bs-example-modal-sm").modal("show"); 
    $('.bs-example-modal-sm .modal-content')[0].remove(); 
    $("#ffrr").html('We call U'); 
}else{ 
    alert('Warning'); 
} 
} 

HTML

<button type="button" class="btn btn-default" onclick="add_comm(); return true;">Send</button> 
+0

你能告訴我們代碼實際上應該做什麼嗎? – Gerton

+1

在.remove()之前刪除[0]。它會工作 –

回答

1

只刪除第一個元素,使用jQuery選擇:

$('.bs-example-modal-sm .modal-content:first').remove(); 

但是,也許你也應該看看模式切換函數,如果你使用引導模式。

相關問題