我在对话框中有一个评论框(textarea)。如果评论成功保存,我想清除textarea的内容并关闭对话框。 ATM对话框将关闭,但我需要擦除其内容。在提交后清空textarea的内容
<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();
}
AND:
<textarea name="ctl00$ContentPlaceHolder1$CommentBox" id="ctl00_ContentPlaceHolder1_CommentBox" type="text" rows="7" maxlength="2000"> </textarea>
所以我猜我即使我试图清空它时没有引用相同的textarea。 也试过
$("#CommentBox.ClientID").val('');
但没有快乐.... ay的想法?
感谢喜的答复,请看到我的编辑 – Mick 2013-03-21 11:07:07
@Mick - 更新根据您的编辑我的答案。 – ahren 2013-03-21 11:09:38
干得好,不同选择工作。感谢您的帮助 – Mick 2013-03-21 11:16:04