javascript - How to change a class' properties after addClass() -


i have form sends email. send data ajax , php file. when data sends, have success function in ajax. if data sent successfully, wanting form display: none; (which have accomplished) , new class appear. know can done addclass() method. however, not understand how can accomplish this. reason being created simple div success message, upon page load hiding div. so, thoughts remove class of email-success because have set display: none; , add class of child div email-success-container. not working.

does know how can accomplish this?

<div class="white-green">   <!-- success div when email sent .. want show after email sends-->   <div class="email-success">     <div class="email-success-container">       <div id="email-success-title">thank contacting our agency!</div>       <div id="email-success-description">your submission has been received , 1 of our team members contact shortly.</div>     </div>   </div>   <div class="project-container">         <div class="project-input-container">   <!-- form email.... shows on page load-->   <form action="" autocomplete="on" method="post" id="project-information-form">     <input type="text" class="input-borderless" id="project-name" placeholder="your name">     <input type="text" class="input-borderless" id="title-roll" placeholder="title/role">     <input type="email" class="input-borderless" id="project-email" placeholder="email address">     <input type="text" class="input-borderless" id="project-number" placeholder="phone number">     <input type="text" class="input-borderless" id="project-company" placeholder="company/url"> </div> <div class="project-input-container2">   <textarea rows="3" class="input-borderless" id="project-description" placeholder="describe project"></textarea>   <input type="text" class="input-borderless" id="project-source" placeholder="how did hear us?">   <input type="text" class="input-borderless" id="project-socialmedia" placeholder="which of our social media influenced most?">   <input type="text" class="input-borderless" id="project-humantest" placeholder="human test: day comess after thursday?"> </div> <input type="submit" id="submit-project" value="send project inquiry"> </form> </div> 

my ajax success:

success: function (data) {     //console.log(data); // data object return response when status code 200     if (data == "error!") {         alert("unable send email!");         alert(data);     } else {         $(".project-container").addclass("removeclass");         $(".white-green").addclass("email-success-container");         $(".white-green").removeclass("email-success");         $(".announcement_success").fadein();         $(".announcement_success").show();         $('.announcement_success').html('email sent!');         $('.announcement_success').delay(5000).fadeout(400);     } }, 

css div trying show after email sends:

.removeclass {     display: none; } .email-success {     display: none; } .email-success-container {     margin-left: 9%;     margin-top: 250px; } #email-success-title {     color: #ba5a45;     font-size: 3em; } #email-success-description {     color: #ba5a45;     font-size: 2em; } 

does know can accomplish this?

you can override display: none; css using .show() , .hide().

$(".email-success").show(); 

this uses inline style attributes, takes precedence on stylesheets.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -