I’m using this code:
$j("#register-form form").submit(function() {
if ($j("input:first").val() == "correct") {
$j("#registration-notification").animate({
height: "21px",
opacity: 1,
'padding-top': "8px"
}, 800 );
return true;
}
$j("span").text("Not valid!").show().fadeOut(1000);
return false;
});
on this form (code from firebug):
<div id="register-form">
<form class="bbp-login-form" action="http://localhost/taiwantalkorgfinal2/wp-login.php" method="post">
<fieldset class="bbp-form">
<h5>Create a Taiwantalk account</h5>
<div class="bbp-username">
<div class="bbp-email">
<div class="bbp-submit-wrapper">
</fieldset>
</form>
to make this notification appear:
HTML:
<div id="registration-notification">
<div id="message">
<span><?php _e( 'Check your email for the username and password' ); ?></span>
<a href="#" id="close-button">x</a>
</div>
</div><!-- #container -->
CSS:
#registration-notification {
background-color: #444;
color: #FFF;
height: 0;
opacity: 0;
padding: 0;
overflow: hidden;
#close-button {
background: #888;
color: #FFF;
float: right;
padding: 0 3px;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
behavior: url(PIE.htc);
&:hover {
background: #BA422B;
color: #FFF;
}
}
#message {
margin: 0 auto;
width: 940px;
span {
float: left;
width: 720px;
}
a {
color: #FFF;
font-weight: bold;
}
}
}
#header {
overflow: hidden;
padding: 9px 0 0;
h1 {
float: left;
height: 19px;
width: 115px;
margin: 1px 20px 0 0;
a {
background: url("images/logo.png") no-repeat scroll 0 0 transparent;
float: left;
height: 19px;
text-indent: -9999px;
width: 115px;
}
}
}
But for some reason, after typing ‘correct’ in the first input and clicking submit, I’m still getting the ‘not valid.’ message. Any suggestions to fix this?
register-form is an id not a class use
#instead of.$("#register-form form").submit(function() {Also I don’t know what is
$juse$orjQuerySee a working demo here http://jsfiddle.net/mEUMr/2/
Make sure to load jQuery and use
$(doument).ready()