How to close light box form after clicking on submit button?

I have a light box form (and have a page in the background). I want to close the light box and stay on that page after clicking on the submit button. But it’s redirecting to another page (PHP database connection page) after clicking the submit button.

I want to know how to close light box and stay on that page.

Answer

Add an event listener to the form that handles the form request and then return false from that handler and the page won’t refresh. Because we don’t know which lightbox you are using we can’t exactly tell you how to remove it… but if you’re using jQuery you could use something like:

$("#lightbox-id").hide();

or

$("#lightbox-id").remove();