2015-04-08 209 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(); 

但是,也许你也应该看看模式切换函数,如果你使用引导模式。

相关问题