Reputation: 29
Problems with JavaScript add/remove class on button click. It just won't perform the function.
Read through a number of stack overflow solutions, none worked for this particular situation.
These are the elements:
// CSS
.hideWelcome{
display: none;
}
.autoHide {
display: none;
}
// JavaScript Hide Welcome
$(document).ready(function() {
$("#showFormBtn").live("click", function() {
$("#WelcomeDiv").toggleClass("fadeOutUp animated hideWelcome");
$("#formInput").toggleClass("autoHide");
});
});
// Welcome Div
<div class="container">
<div class="row">
<div id="WelcomeDiv" class="one-half column fadeInUp animated" style="margin-top: 25%">
<h4>Make a Difference</h4>
<p>Volunteer today!</p>
<div class="bounceIn animated">
<input type="button" id="showFormBtn" name="showFormBtn" class="button button-primary" value="Sign Up"/>
</div>
</div>
// Div to show
<div id="formInput" class="one-half column fadeInUp animated autoHide" style="margin-top: 25%">
<h4>HELLO YA'LL</h4>
<p>Howdy!</p>
<div class="bounceIn animated">
<input type="button" id="showFormBtn" name="showFormBtn" class="button button-primary" value="Sign Up"/>
</div>
</div>
</div>
</div>
Upvotes: 0
Views: 283