montrealmike montrealmike - 1 year ago 84
Javascript Question

Javascript modal to replace prompt?

What is the best way to replace

var value = prompt("Enter a URL", "");

by a javascript modal (preferably pure javascript, if not possible then jquery)


Answer Source

You will need to change theway you call it, so it now follows event-driven programming style like that:

function prompt(question, callback) {
    // here build a modal/form and after form submit:

And then use it like that:

prompt('Enter a URL:', function(result){
    // do something with the result:
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download