Kanhu Bhol Kanhu Bhol - 1 year ago 57
CSS Question

How to display radio button on an alert box

Is it possible to have a radio button in an alert box?
The requirement is, not to use any modal box, that why we just think if it's possible with alert box or confirm box. then we can good to go.

Any help will appreciate.
Sample Screenshot is below.

enter image description here

Answer Source

i don't guess. i know that this is in fact impossible. the reason is simple:

alert(), prompt() aswell as confirm() were part of html + js since js exists.
they never got deprecated though they break the asyncronous flow of javascript.

this is essentially why they only allow you to play around with strings.
they were never intended to be feature rich.
they were actually invented out of the blue because the inventor (Brendan Eich) thought they'd come in handy. (wich at that time was more than enough for everyone)

they are by design blocking operations and should be avoided as much as possible.

to get around them simply create a so called modal dialog (thats basically a <div> with position: fixed above the pages content.

you can easily make it appear as you want and you would not break any network connections or behavior of your application.

don't use w3schools as reference for learning or anything else.
they are a low quality database. you should look stuff up on mdn or other sites but should seriously avoid w3schools since it's not feature complete on any topic.
keep in mind this is an opinion.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download