<分区>
我在对话框中有一个评论框(文本区域)。如果成功保存评论我想清除文本区域的内容并关闭对话框。 ATM 对话框将关闭,但我需要删除其内容。
<textarea id="CommentBox" type="text" runat="server" rows="7"
maxlength="2000" />
if (CommentSuccessfullyUpdated == "TRUE")
{
//empty the comment box??
//something like
$("#CommentBox").empty();
//closes the dialog box
$("#dialog").dialog('close');
感谢您的回复
编辑: 感谢您的帮助。它正在运行代码,但无法正常工作。我认为这与为了选择正确的值并解决我必须使用的出价问题有关:
function SubmitButton() {
var commentBoxData = $('#<%=CommentBox.ClientID%>').val();
}
运行断点时返回:
function SubmitButton() {
var commentBoxData = $('#ctl00_ContentPlaceHolder1_CommentBox').val();
}
和:
<textarea name="ctl00$ContentPlaceHolder1$CommentBox" id="ctl00_ContentPlaceHolder1_CommentBox" type="text" rows="7" maxlength="2000"> </textarea>
所以我猜我在尝试清空文本区域时没有引用相同的文本区域。 也试过了
$("#CommentBox.ClientID").val('');
但没有快乐......有什么想法吗?