我有一個div在css(display:none;)中沒有顯示任何東西,但是當我使用jquery .show()方法時,它只會閃爍第一頁。這裏是我的html代碼.show()方法不像它應該在jquery中工作
<center><div style="margin-top:100px;margin-bottom:100px;border:1px solid black;">
<div class="logIn" id="login">
<form action="Login.php" method="post" name="login">
<h4> Log into your Irokko Account </h4><br/>
Username:<br/>
<input type="text" name="username"><br/><br/>
Password:<br/>
<input type="password" name="password"><br/><br/>
<input type="submit" value="Log In" name="login"> <input id = "create" type="submit" name="account" value="Create Account"> </form>
<a href="#ForgotPassword" style="font-size:12px; color:blue;text-decoration:underline">Forgot Password</a> <br><br/>
<div id="ForgotPassword" class="modalDialog">
<div>
<a href="Login.php" title="Close" class="close">X</a>
<h2>Retrieve Password</h2>
<form action="Login.php" method="post" name="login">
<p>Please enter your email address to retrieve your password.</p><br/><br/>
<input type="email" name="email" size="65"><br/><br/>
<input type="submit" value="Send" ><br><br>
</form>
</div>
</div>
</div><br><br>
<div id="signup" class="hide">
<form action="login.php" method="post" name="signup" onSubmit="return validatesignup();">
Confirm Password:<br/>
<input type="password" name="confirmpassword" size="40"><br/><br/>
Account Type:<br/>
<select name="accounttype" class="width">
<option></option>
<option>Advertiser</option>
<option>Publisher</option>
</select><br/><br/>
Company Name:<br/>
<input type="text" name="companyname" size="40"><br/><br/>
Email address:<br/>
<input type="email" name="email" size="40"><br/><br/>
Country:<br/>
<input type="text" name="country" size="40"><br/><br/>
<input type="submit" name="createaccount" value="Create Account"><br><br>
,這裏是我的CSS代碼
.hide{
display:none;
}
及以下的jQuery代碼
$(document).ready(function(){
$(".hide").hide();
$("#create").click(function(){
$(".hide").show();
});
});
您沒有任何元素與你已經包括在HTML「創造」的ID,但你的點擊處理程序分配給具有該ID的元素。 –
請發佈完整的問題,你關閉div和窗體。 –
你在你的代碼中沒有div「.hide」,我要求你輸入正確的代碼 –