Window.prompt multiple lines of input CSS JavaScript

I am trying to find a way to do something equivalent to window.prompt , but allowing a few lines of input.

I could create my own using a z-index div containing textArea , but I hope there is something there in jQuery or a plugin that would be more elegant.

Any ideas?

+6
source share
1 answer

You can use jQuery Dialog for this.

Here is an example: http://jsfiddle.net/RBKaZ/

Using this HTML

 <div id="dialog"> <p>Please enter your name</p> <textarea id="name"></textarea> </div> <label>Name entered: </label> <label id="nameentered"></label> <br /> <input type="button" id="open" value="Open Dialog" /> 

And this jQuery:

 $("#dialog").dialog({ autoOpen: false, buttons: { Ok: function() { $("#nameentered").text($("#name").val()); $(this).dialog("close"); }, Cancel: function () { $(this).dialog("close"); } } }); $("#open").click(function () { $("#dialog").dialog("open"); }); 
+10
source

All Articles