开发者

How to close a modal box after form submit?

I am using the css modal box described by Paul R.Hayes here - http://w开发者_JS百科ww.paulrhayes.com/experiments/modal/

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?


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')">


I assume the close button of the modal button calls a Javascript function. For instance "CloseModal()". In your form tag, you can use the following code to call that function:

<form name="myform" action="myconfpage.extension" target="iframe" onSubmit="CloseModal();">

This will call the close function on submitting of the form.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜