Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

replace prompt with UI dialog

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);
    }
});
like image 565
Ntguy Avatar asked Mar 08 '11 16:03

Ntguy


1 Answers

Use jQuery UI.

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

like image 84
Mahesh Avatar answered Sep 30 '22 14:09

Mahesh