[英]Empty the text box if data's are entered
Data's entered in the popup text box gets cleared if cancel button is pressed. 如果按下取消按钮,则会清除在弹出文本框中输入的数据。
I used the below code for performing this, 我使用以下代码执行此操作,
function clear()
{
document.getElementById("spacevalidate").setTextValue() = "";
}
html is for popup box is HTML是弹出框是
<div id="overlay_form" style="display:none">
<h2> Create New Incident Type</h2>
<br />
Name
<input type="text" id="spacevalidate" style="height:30px;" name="title" maxlength="30" /><br />
<div style="width:180px;float:right;margin:20px 5px 0 10px">
<button id="bsave" type="submit" name="save" title="Save" class="forward">Save</button>
<button style="margin-right:10px;" type="button" id="close" name="cancel" class="forward backicon">Cancel</button>
</div>
update: 更新:
$(document).ready(function(){
//open popup
$("#addalist").click(function(){
$("#overlay_form").fadeIn(1000);
positionPopup();
});
1.Now i enter some data and press cancel button,again i open the same popup,data's are avail in the text box.I want to clear that on every open if some data's entered and cancel button is pressed. 1.现在我输入一些数据并按“取消”按钮,再次打开同一弹出窗口,文本框中将显示数据。如果要输入某些数据并按“取消”按钮,我想清除每次打开的数据。
Try this, 尝试这个,
function clear()
{
document.getElementById("spacevalidate").value = "";
}
正如Cam所说,只需在打开模式的函数中调用clear()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.