Alex Alex
Alex Alex

Reputation: 1

How to close modal window after submit button?

I have modal window with pure css. When I click submit button, my modal window does not disappear. How can I hide my modal window? Here is my code. Here is CSS and HTML code. Do you have any ideas?

 <div class="banner-content text-center" >


                            <br/><br/>
                            <a href="#open-modal" class="myButton">ORDER</a>    

                            <div id="open-modal" class="modal-window" id="modal-window">
                             <div>
                                <a href="#modal-close" title="Close" class="modal-close">Close</a>
                                <h1>Contact Form</h1>
                                <div>
                                    <div class="container">
                                          <form name="contactform" method="post">


                                            <input type="text" id="fname" name="first_name" >


                                            <input type="text" id="lname" name="email">


                                            <input type="text" id="phone" name="phone" >


                                            <textarea id="subject" name="subject" style="height:150px"></textarea>

                                            <input type="submit" name="submit" id="submit" value="Send">

                                          </form>
                                    </div>
                                </div>
                            </div>
                            </div>
                        </div>

Upvotes: 0

Views: 704

Answers (1)

JKimbrough
JKimbrough

Reputation: 236

Using Bootstrap - try this:

$('#submit').submit(function(e) {
        e.preventDefault();
        $('#IDModal').modal('hide');
        return false;
    });

Also - I don't see a button type. I would recommend switching <input type="submit" name="submit" id="submit" value="Send"> to < <button type="submit" name="submit" id="submit" value="Send">.

Let me know your results!

Upvotes: 1

Related Questions