modal
modal copied to clipboard
Ajax always creates new modal
Not sure if this is intentional, so this may just be a request for clarification, but in the following code segment:
https://github.com/shaneriley/modal/blob/master/source/javascripts/jquery.modal.js#L98-L106
...any time you use Ajax for a modal invocation, a new modal is created and any modal selectors are ignored. This proves undesirable when you're launching multiple modals from a single page and one of them is written server-side, as there end up being multiple elements on the page with an id of 'modal'.
Even outside that situation, the choice to always create a new modal when Ajax is being used seems odd.
I've had the same issue for a while, but haven't had the time to rewrite that section of the plugin. I've used the afterClose method to remove the modal until I've been able to work on it.
jquery.modal.js:98
is if (!m.ajax && !m.$el.length) {
it should be if (!!m.ajax && !m.$el.length) {
(extra "!" as the beginning fixed it for me locally.