本文介绍了如何在javascript中清除标签值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从.cs [c#代码] text =数据成功保存"中得到了一个标签"test" comimg.但是点击保存按钮后,我需要清除其文本现在我有3个必填字段验证器.带有消息[不能为空,不能为空,不能为空,]用户单击保存按钮时,我需要清除标签的文本.但是需要显示必填字段验证器消息
I have an label "test" comimg from .cs [c# code] text="data saved successfully" . but once I click the save button i need to clear its textright now I have 3 required field validators. with message [cannot be blank, cannot be blank,cannot be blank,] as user as clicked the save button I need to clear the text of the label. But need to show the required fields validator message
任何解决方法的想法
谢谢
推荐答案
使javascript函数如下:
make a javascript function like:
<Script type="text/javascript">
function clearText(cntId) {
var cnt = document.getElementById(cntId);
cnt.value ="";
return false;
}
</script>
then on your submit button attach a client side event
<asp:Button id='btnSubmit' Text='Submit' onClientClick='clearText("<%this.lblLable.ClientId%>");' .... />
这篇关于如何在javascript中清除标签值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!