我想我的按钮(我生成很多与asp.net内<%%标签。)将显示“textboxHidden”div,然后切换“响应”和“关闭”之间的按钮值。如果我再次单击“关闭”按钮,我希望它再次隐藏div ...jquery .show和.toggle打开和关闭一次点击
在现实中,当我单击按钮时,它会隐藏并显示div几次,然后隐藏“close “按钮” 这是为什么
那在div:
<div id="buttons">
<span class="reply"></span><span class="reply">
<input type="button" id="replyButton<%=i %>" value="Respond" onclick="showTextArea('<%=i %>')" />
</span>
</div>
<div id="textboxHidden<%=i %>" style="display: none;">
<textarea style="width: 500px; height: 70px;" name="forum_topic_comment<%=i %>" id="forum_topic_comment<%=i %>"></textarea>
<div id="hiddenSave<%=i %>" style="display: none;">
<input type="button" value="Save" onclick="submitComment('<%=i %>');" />
</div>
</div>
那jQuery代码:
function showTextArea(i) {
$("#replyButton" + i).click(function() {
$("#textboxHidden" + i).toggle(200);
$("#hiddenSave" + i).show(200);
$("#replyButton"+i).val('Close').toggle();
});
}
感谢助手
谢谢!有用!。但是如何让“关闭”再次隐藏时又变为“响应”? – thormayer 2012-03-06 12:40:11
@thormayer:代码已更新。 – codef0rmer 2012-03-06 13:01:17