1

I have the following code :

var answer = prompt('ENTER YOUR TEXT);

When javascript executes it puts up the prompt box but gives it a title on top of the box of the html file that this code is part of.

Any way to get rid of that?

Boaz
  • 19,892
  • 8
  • 62
  • 70

1 Answers1

0

No, this isn't possible. Try something like apprise instead

Apprise('Name:', {input:true});

http://labs.bigroomstudios.com/libraries/Apprise-v2

Edit below

This solves the issue in a neat way!

window.prompt = function(text, callback) {

    var options = {
        buttons: {
            confirm: {
                text: 'Send',
                action: function(e) {
                    callback(e.input);
                    Apprise('close');
                }
            },
        },
        input: true
    };

    Apprise(text, options);
};

prompt("Say something", function(returnValue) {
    console.log(returnValue);
});
Eric Herlitz
  • 25,354
  • 27
  • 113
  • 157
  • 1
    Not familiar with Appraise, but when using that or similar solutions, be warned that they are not blocking, so code that comes after displaying the modal dialog will be executed before user takes action. This may or may not be what you want. Sometimes a callback function can solve this problem, sometimes it can't. –  Nov 03 '13 at 16:22
  • Not sure how to use the above code. Where do I put it and where does it take the info the user puts in (i guess what you're calling return value) and makes a variable of it, say call it "answer" as in my original post? – stephen kronwith Nov 03 '13 at 22:00
  • and you also have Apprise in the code. Where and how is Apprise defined. I'm a newbie at this. – stephen kronwith Nov 03 '13 at 22:01