Show a list of options using a JavaScript prompt

In JavaScript, is it possible to display a list of options that need to be clicked using the prompt window, rather than a list of options that need to be entered manually?

I would like to present each option as a button, instead of asking the user to enter the parameters manually (as shown here):

var OptionChosen = prompt('Enter 1, 2, 3, or 4:')

+4
source share
1 answer

You cannot do this.

You can use the jQuery dialog to do this.

See here for jQuery dialog

 var selected = 0; $('#id').dialog({ buttons: { "First": function() { selected = 1; }, "Second": function() { selected = 2; }, "Third": function() { selected = 3; }, "Fourth": function() { selected = 4; } ............... } }); 
+4
source

Source: https://habr.com/ru/post/1480835/


All Articles