我试图让下面的代码行淡出窗体的类“.quote”,并将其替换为类“.thanks”的DIV。当按钮被点击时。它只在点击输入区域时才起作用,但不会消失div.thanks
。通过fadeIn/fadeOut切换元素
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".quote, .thanks").click(function(){
$('form:fadeIn(:.thanks)').fadeOut (5000);
});
});
</script>
<style type="text/css">
<!--
.thanks {
display: hide;
}
-->
</style>
</head>
<body>
<form action="" method="get" id="quote" class="quote">
<p>
<label>
<input type="text" name="name" id="name" />
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</p>
</form>
<div class="thanks">Thanks for contacting us, we'll get back to you as soon as posible</div><!-- End thanks -->
我也想知道如何使它得到了观众的姓名和在div.thanks
插入。
@ Dz1:您试图添加称为“评论”而不是“编辑”的内容。相反,请使用“添加评论”进行评论。 – BoltClock 2011-03-30 19:37:29
BoltClock感谢您的更正 – 2011-03-31 15:32:34