How to close a modal box after form submit?

Tags: html,css,forms

Problem :

I am using the css modal box described by Paul R.Hayes here -

I have inserted a form into the modal box. The form target is in an iframe which is hidden on the same page. I want to close the modal window as soon as the form submits. But the form should be processed within the iframe (hidden).

How can I achieve this?

Solution :

It looks like the modal window is closed by any url linking to the #close html fragment.

Therefore adding the following code to the submit handler of your form should close the modal on submission.

<form ... onsubmit="window.location.assign('#close')">

    CSS Howto..

    How to create a darker background on a whole page with one new div

    Speechbubble tooltip in CSS - how to move the arrow

    How do I load a CSS file with HTMLTextWriter

    How to position AdSense on site with CSS position: absolute

    How to get the Tololtip Tail for Menu

    How to provide a stylesheet for rendering PDFs?

    How does a GPL license restrict commercial web applications? [closed]

    How to snap divs together vertically in CSS like Pinterest have

    How can I get horizontal overflows to work in CSS?

    how to trigger a stored property with css color change?

    How to align
  • to the top when higher items are hidden via CSS
  • Jquery content slider, how to duplicate without redundant code

    How to create a box with header with css styling?

    How to make text labels stick next to an image in CSS?

    Asp.Net-MVC: How to style <%=Html.ActionLink()%> with Css?

    How to call
  • tag CSS
  • How do I get responsive images to stay equivalent heights as they scale?

    CSS: Double-Border, how to [duplicate]

    How to styling div with CSS fixed width and auto-resize?

    How to reuse CSS selector?

    How can I place two DIVs inside a horizontal fixed header and make all the content vertically align?

    How to fix background image inside div

    How to create rating system using only css [duplicate]

    How to add Button over image using CSS?

    How did overflow actually work here?

    How do I correct this error?

    How hard is it to make an expanding tab in CSS?

    How do I get these two columns to have the same height at all times - CSS?

    CSS flex, how to display one item on first line and two on the next line

    How to make a Xul button bigger using css as it get focus?