Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put select element in a javascript prompt?

Tags:

javascript

I would like to have a javascript prompt pop up that has a selection element in it rather than a text input. When searching for a solution it seems that using jquery could definitely work but I am new to HTML and javascript and the tutorials for a jquery popup are daunting (I cannot figure out how to implement them)! Is it possible to create such a pop up with just javascript? I was hoping something like this would be possible:

prompt(<select>[options...]</select>);

Thanks in advance!

like image 854
ORL Avatar asked Jan 23 '12 15:01

ORL


2 Answers

What you're looking for is called a modal dialog. This is really just a DIV with HTML inside it, with an overlay over the rest of the page.

You can roll-your-own or use a ready-made one from a library.

like image 105
Diodeus - James MacFarlane Avatar answered Oct 05 '22 22:10

Diodeus - James MacFarlane


No it's not possible with prompt; If you want such thing you'll have to fake a dialog box in javascript

like image 22
Wesley Avatar answered Oct 05 '22 23:10

Wesley