I have an HTML code with 2 types of messages when a Sign up DIV is clicked. When Sign Up error is clicked, the error message is displayed. When sign Up success is clicked, the success message is displayed. By default these messages are set to display:none.
My target output is to create a separate jQuery function "detectDisplay()" that executes "ONLY when success message has a CSS code display:block".
Below is my code. Any help is appreciated. Thanks.
CSS:
.cs_error { display: none; }
.cs_success { display: none; }
HTML:
<div class="cs_signUp" onclick="showError(); detectDisplay();">Sign up » error </div>
<div class="cs_signUp" onclick="showThanks(); detectDisplay();">Sign up » success </div>
<br/>
<div class="cs_success">
<div>Thank you for signing up!</div>
</div>
<div class="cs_error">
<div>Invalid input! Please try again!</div>
</div>
SCRIPT:
function showError() {
$(".cs_success").css("display","none");
$(".cs_error").css("display","block");
}
function showThanks() {
$(".cs_error").css("display","none");
$(".cs_success").css("display","block");
}
function detectDisplay() {
}
showThanks()function will suffice, no?