Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript alert popup form

i have search this whole site and google but cannot find it so, here goes!

i would like a way to show a form when using alert.

for example, when user click post, a dialog pop with asking user a few question like a html form and allow user to click submit or reset or cancel, without loading a new page.

i have seen this done but cannot find the same site again.

i have tried putting htm to alert with little success of posting.

any Help is Highly Appreciated!

like image 723
Poppy Avatar asked Apr 19 '26 04:04

Poppy


1 Answers

What you are looking for is a Prompt Box:

<script type="text/javascript">
    function show_prompt() {
        var name = prompt('Please enter your name','Poppy');
        if (name != null && name != "") {
            alert(name);
        }
    }
</script>

example taken from here: http://www.w3schools.com/js/js_popup.asp

like image 189
Stephen Avatar answered Apr 21 '26 18:04

Stephen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!