replace prompt with UI dialog

16,301

Use jQuery UI.

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

Share:
16,301
Admin
Author by

Admin

Updated on July 24, 2022

Comments

  • Admin
    Admin over 1 year

    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);
        }
    });