replace prompt with UI dialog

我的未来我决定 提交于 2019-12-09 12:36:09

问题


How can I replace the prompt in this code with a simple UI dialog to achieve the same thing. IE is warning about security when using prompt.

HTML:

<input type="text" id="txt1" name="textbox1">
<input type="button" id="btn" name="buttonExecute" value="Enter number">

JavaScript:

$('#btn').click(function() {
    var n = prompt('Please enter number');
    if ( n!=null && n!="" ) {

    var fixed=n.substr(1,9);

     $('#txt1').val(fixed);
    }
});

回答1:


Use jQuery UI.

See a simple demo here. http://jsfiddle.net/5yhmb/23/




回答2:


Have a look at the jQuery UI Dialog widget: http://jqueryui.com/demos/dialog/



来源:https://stackoverflow.com/questions/5235409/replace-prompt-with-ui-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!