Javascript 清除Jquery UI对话框输入框
我使用以下代码作为系统的一部分,每15-30分钟随机弹出一个对话框窗口,需要用户输入才能继续:Javascript 清除Jquery UI对话框输入框,javascript,jquery,html,Javascript,Jquery,Html,我使用以下代码作为系统的一部分,每15-30分钟随机弹出一个对话框窗口,需要用户输入才能继续: $(document).ready(function() { $dialog = $('<div></div>') .html('Are you awake? Please enter your user ID in the following box:<br/><br/><input type="text" id="dia
$(document).ready(function() {
$dialog = $('<div></div>')
.html('Are you awake? Please enter your user ID in the following box:<br/><br/><input type="text" id="dialog-input"><p></p></input><br/><br/><button id="timerButton">Yes</button><br/><br/>If you do not press yes within 10 minutes, the office will be contacted.')
.dialog({
autoOpen: false,
title: 'Inactivity Monitor'
});
});
感谢您提供的帮助,请尝试使用.val(“”)而不是html(“”)解决方案是:
$("#dialog-input").val("");
输入的值保存在
value
属性中。您需要使用$(“#对话框输入”).val(“”) 谢谢,效果很好。我试着用错词了!
$("#dialog-input").val("");