2017-03-24 5 views
0

こんにちは私は単純なJqueryの質問があります。ユーザーが完了したときに感謝のメッセージを表示するシンプルなjqueryポップアップフォームがあります。彼らはそれを閉じます。私は、ボックスをリセットして元のフォームを表示するのに困っています。jqueryを閉じてカスタムボックスをリセットする

\t //open popup Book a demo 
 
\t $(".actionButtonHeader, .bookADemoBTN").click(function(){ 
 
\t $("#overlay_form").fadeIn(1000); 
 
    \t $(".background_overlay").fadeIn(500); 
 
\t positionPopup(); 
 
\t e.preventDefault(); 
 
\t }); 
 
\t 
 

 

 
    \t var email = document.getElementById("email").value; 
 

 
\t  \t var subscribed = document.getElementById("subscribed").value 
 

 
\t  \t $("#overlay_form").submit(function(e) 
 
\t \t \t { 
 
\t \t \t  var postData = $(this).serializeArray(); 
 
\t \t \t  $.ajax(
 
\t \t \t  { 
 
\t \t \t   url : "demoEmailProcess.php", 
 
\t \t \t   type: "POST", 
 
\t \t \t   data : postData, 
 
\t \t \t   success:function(data, textStatus, jqXHR) 
 
\t \t \t   { 
 
     
 
\t \t \t \t \t  $(".formContent").html("<div id='messageDemo'><h2 style='text-align: center; font-size: 27px;'>Thank you " + (fullName.value).split(" ")[0]+ "!" + "</h2>" + "<p style='font-size: 21px;'> Your message has beeen successfully sent. We appreciate your interest in Cybertonica and will get back to you within the next 24 hours. </p>" + "<a class='messageLink' href='index.php'>Return to Homepage</a></div>") 
 
\t \t \t \t \t  
 
\t \t \t   }, 
 
\t \t \t   error: function(jqXHR, textStatus, errorThrown) 
 
\t \t \t   { 
 
\t \t \t    
 
\t \t \t   } 
 
\t \t \t  }); 
 
\t \t \t  e.preventDefault(); 
 
\t \t \t }); 
 
\t \t \t 
 
\t \t \t $("#ajaxform").submit(); //Submit the FORM 
 

 

 
\t //close popup Book a demo 
 
\t $(".close").click(function(){ 
 
\t $("#overlay_form").fadeOut(500); 
 
\t $(".background_overlay").fadeOut(500); 
 
\t });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div class="background_overlay"></div> 
 
\t <form id="overlay_form" style="display:none" action="" method="post" > 
 
\t <div class="close"><div class="innerClose">X</div></div> 
 
\t <div class="formContent"> 
 
\t \t <b class="popupText">Want to see how we manage fraud and increase sales? We would love to hear from you. Book a demo with Cybertonica!</b> 
 
\t \t <p class="popupText">Briefly explain your business needs and how you manage fraud and we will happily get back to you within the next 24 hours.</p> 
 
\t \t <p id="returnmessage"></p> 
 

 
\t \t <div class="popupRowOne"> 
 

 
\t \t <li><b>Full Name<sup>*</sup></b> 
 
\t \t <input id="fullName" name="fullName" required type="text"> 
 
\t \t </li> 
 

 
\t \t <li><b>Company Name<sup>*</sup></b> 
 
\t \t <input required name="companyName" id="companyName" type="text"></li> 
 
\t \t </div> 
 

 
\t \t <div class="popupRowTwo"> 
 
\t \t 
 
\t \t <li><b>Email<sup>*</sup></b> 
 
\t \t <input required name="address" id="address" type="text"> 
 
\t \t </li> 
 
\t \t 
 
\t \t <li><b>Job Title<sup>*</sup></b> 
 
\t \t <input required name="jobTitle" id="jobTitle" type="text"> 
 
\t \t </li> 
 

 
\t \t <li id="hiddenPot"><b>Please leave this blank<sup>*</sup></b> 
 
\t \t <input type="text" name="email" id="email"> 
 
\t \t </li> 
 

 
\t \t </div> 
 

 
\t \t <div class="popupRowThree"> 
 
\t \t \t 
 
\t \t \t <li><b>Your Message<sup>*</sup></b> 
 

 
\t \t \t <input name="textMessage" id="textMessage" class="textareaPopup" required> 
 
\t \t \t 
 
\t \t \t </li> 
 

 
\t \t </div> 
 
\t \t 
 
\t \t <div id="contactSubscribe"> 
 

 
\t \t \t <p class="checkBoxText"><input type="checkbox" id="subscribed" value="subscribed" name="subscribed" checked> I would like to sign up to Cybertonica newsletter</p> 
 

 
\t \t \t <button type="submit" id="submit" value="Submit" class="popUpactionButton">Submit</button> 
 

 
\t \t </div> 
 
\t </div> 
 
\t \t \t 
 
\t </form>

答えて

0

このお試しください:この行を追加します

$(".background_overlay").fadeOut(500); 

:後

$("#overlay_form").reset(); 
+0

申し訳didntの仕事を、何も起こりません –

関連する問題