Search code examples
jqueryjquery-pluginshtmlsimplemodalvisible

Simple Modal on a hidden div


I want to have a hidden div on the page with the elements of a SimpleModal dialogue, but when I set the CSS visibility to hidden and fire the modal, it is empty.

How can I use a DIV in this fashion without making it visible on the page?


Solution

  • Instead of visibility: hidden; what you want is display: none;. Most jQuery plugins work off display instead of visibility (even more core jQuery functions related to showing/hiding do this).

    SimpleModal (and every other jQuery modal I know off) will reverse display: none when they show the modal...they're actually expecting this :)