Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 清除Jquery UI对话框输入框_Javascript_Jquery_Html - Fatal编程技术网

Javascript 清除Jquery UI对话框输入框

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

我使用以下代码作为系统的一部分,每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="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("");