gpt4 book ai didi

jQuery .submit 没有被触发?

转载 作者:行者123 更新时间:2023-12-01 08:21:08 25 4
gpt4 key购买 nike

我正在使用此代码:

$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;
});

在此表单上(来自 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>

要显示此通知:

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;
}
}
}

但由于某种原因,在第一个输入中输入“正确”并单击“提交”后,我仍然收到“无效”。信息。有什么建议可以解决这个问题吗?

最佳答案

register-form 是一个 id,而不是一个类,使用 # 而不是

$("#register-form 表单").submit(function() {

另外我不知道什么是 $j 使用 $jQuery

在此处查看工作演示 http://jsfiddle.net/mEUMr/2/

确保加载 jQuery 并使用 $(doument).ready()

关于jQuery .submit 没有被触发?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7332142/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com