modal icon indicating copy to clipboard operation
modal copied to clipboard

Ajax always creates new modal

Open hashrocketeer opened this issue 11 years ago • 2 comments

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.

hashrocketeer avatar Jan 03 '14 16:01 hashrocketeer

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.

shaneriley avatar Jan 03 '14 18:01 shaneriley

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.

mrmicahcooper avatar Feb 13 '14 19:02 mrmicahcooper