[英]Empty the text box if data's are entered
如果按下取消按鈕,則會清除在彈出文本框中輸入的數據。
我使用以下代碼執行此操作,
function clear()
{
document.getElementById("spacevalidate").setTextValue() = "";
}
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>
更新:
$(document).ready(function(){
//open popup
$("#addalist").click(function(){
$("#overlay_form").fadeIn(1000);
positionPopup();
});
1.現在我輸入一些數據並按“取消”按鈕,再次打開同一彈出窗口,文本框中將顯示數據。如果要輸入某些數據並按“取消”按鈕,我想清除每次打開的數據。
嘗試這個,
function clear()
{
document.getElementById("spacevalidate").value = "";
}
正如Cam所說,只需在打開模式的函數中調用clear()
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.