我在尝试让 fadeIn/Out 方法和表单提交在同一个脚本中发生时遇到问题。
通常情况下,一个会起作用,而另一个不会。我已经为此工作了大约 6 个小时,我确信有些逻辑我不幸忽略了。
非常感谢您对如何编写此内容的解释或细分!
HTML
<form id="form" action="#">
<div class="formmesage"><p>Hi, I'm </p></div>
<div class="nameinput">
<input id="name" class="required" type="text" name="name" placeholder="name" tabindex="1">
</div>
<div class="formmesage"><p>and I'm a </p></div>
<div class="selection">
<select id="profession" name="profession" tabindex="2">
<option type="text" value="designer">designer</option>
<option value="developer">developer</option>
<option value="designer & developer">designer & developer</option>
</select>
</div>
<div class="formmesage"><p>looking to meet other </p></div>
<div class="selection">
<select id="pairprofession" name="pairprofession" tabindex="3">
<option type="text" value="designer">designers</option>
<option value="developer">developers</option>
<option value="designer & developer">designer & developers</option>
</select>
</div>
<div class="formmesage "><p>in</p></div>
<div class="selection">
<select id="location" name="location" tabindex="4">
<option type="text" value="New York" p>New York</option>
<option value="Boston">Boston</option>
<option value="Chicago">Chicago</option>
</select>
</div>
<div class="btn">
<input id="email" class="required email" type="text" name="email" placeholder="email@address.com" tabindex="5">
<button type="submit">submit</button>
</div>
</form><!-- form -->
查询
$(document).ready(function(){
$("#form").validate();
$("#form").submit(function(){
$("button").click(function(){
$("#form").delay(500).fadeOut("slow");
$(".message").delay(1000).fadeIn("slow");
return false;
})
})
})