在页面加载时,我有两个 div 块“replyComment”和“tobereplaced”
<div id="replyComment">
<form id="myForm" name="myForm" method="post" action="reply.php" >
<textarea name="suggestions" rows="5" cols="60" style="resize:none" onfocus="this.value=''">Enter your reply here</textarea>
<input type="hidden" name="hidden">
<input type="hidden" name="hidden2" >
<a href="blog.php?page=hm"><img src="html_images/cancel.png" onmouseover="src='html_images/cancelhover.png'" onmouseout="src='html_images/cancel.png'" alt="Cancel"/></a>
<input type="image" name="Post" value="Reply" alt="Reply" src="html_images/reply.png" onmouseover="src='html_images/replyhover.png'" onmouseout="src='html_images/reply.png'"/>
</form>
</div>
<div name="tobereplaced">
<img src="html_images/reply.png" class="ajax-func" onmouseover="src='html_images/replyhover.png'" onmouseout="src='html_images/reply.png'" />
</div>
我正在尝试在加载时隐藏replyComment div,并将其切换为在点击时显示以替换为以下jquery。
$(document).ready(function () {
$(".replyComment").hide();
$(".ajax-func").click(function(evt) {
$(this).prevAll(".replyComment:first").slideToggle("fast");
$(this).toggleClass("active");
return false;
});
});
但是replyComment不会在页面加载时隐藏,也不会切换..我是jquery的新手,任何帮助将不胜感激..