Closed. This question is off-topic。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        5年前关闭。
                                                                                            
                
        
我在模态中有一个表单,当用户单击提交时,将验证该表单,如果它包含错误,则不会提交,因此用户可以单击模态关闭按钮或在任何位置关闭模态或隐藏它,然后,如果用户重新打开模式,验证css将保留在表单中,就像以前一样,所以问题是我如何在没有任何验证css的情况下将表单重置为清晰的字体显示呢?我用过,但是没用:

$('#newsletterModal').on('hidden.bs.modal', function () {

            $('#newsletter')[0].reset();

             $('#newsletter')
                        .bootstrapValidator('disableSubmitButtons', false)  // Enable the submit buttons
                        .bootstrapValidator('resetForm', true);
        });

最佳答案

$('#clear-form').on('click', function()
    {
        $('#my-form').find('input:text, input:password, select, textarea').val('');
        $('#my-form').find('input:radio, input:checkbox').prop('checked', false);
});

10-05 20:56
查看更多