Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajax always creates new modal #3

Open
hashrocketeer opened this issue Jan 3, 2014 · 2 comments
Open

Ajax always creates new modal #3

hashrocketeer opened this issue Jan 3, 2014 · 2 comments

Comments

@hashrocketeer
Copy link

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.

@shaneriley
Copy link
Owner

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.

@mrmicahcooper
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants