Answer the question
In order to leave comments, you need to log in
Disappeared form (not popup) after submitting a message. How to fix?
When sending a message, the form itself disappears. Here is the code
$(document).ready(function(){
$('#contact-form1').submit(function(){
var subject = $(this).find("#subject1 :selected").text();
var name = $(this).find("#name1").val();
var email = $(this).find("#email1").val();
var message = $(this).find("#message1").val();
if(!!name && !!email && !!message){
$.ajax({
type: "POST",
url: "/email1.php",
data: {"subject1": subject, "name1": name,"email1": email, "message1": message},
cache: false,
success: function(){
jQuery('#contact-form1').html("<div id='otpravlen'></div>");
jQuery('#otpravlen').html("<h2>Вопрос отправлен!</h2>")
.append("<p>Скоро мы с вами свяжемся.</p>")
.hide()
.fadeIn(1500, function() {
$('#otpravlen').append();
})
.fadeOut(1500, function() {
$('#otpravlen').remove();
});
}
})
}
return false;
});
});
Answer the question
In order to leave comments, you need to log in
Because this line
jQuery('#contact-form1').html("<div id='otpravlen'></div>");
you remove everything inside the form and insert a new div in there. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question