How to create a tooltip in javascript with 3 checkboxes / radio buttons as a choice?

How to create a javascript tooltip in which you need to choose one of 3 options? I am looking to make something similar to the html form of the radio buttons, except in the javascript tooltip.

+6
source share
3 answers

You can use jQuery and make a dialog with three buttons (). Check the working jsFiddle daemon :

$("#dialog").dialog({ autoOpen: true, buttons: { Yes: function() { alert("Yes!"); $(this).dialog("close"); }, No: function() { alert("No!"); $(this).dialog("close"); }, Maybe: function() { alert("Maybe!"); $(this).dialog("close"); } }, width: "400px" }); 
+5
source

This cannot be achieved initially as .prompt() . This functionality requires more advanced JS. Here are some libraries you can contact:

Could be more adequate. For some time I used such material.

+1
source

You cannot do this from the alert window if that is what you mean. But you could use any number of libraries to create a popup, which is basically just a and makes your form inside.

Then you can bind a button or something else to a function that closes the box and parses the form in your structures in Javascript.

+1
source

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


All Articles