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

$.fn is undefined #145

Closed
KhoaSydney opened this issue Apr 29, 2015 · 16 comments
Closed

$.fn is undefined #145

KhoaSydney opened this issue Apr 29, 2015 · 16 comments

Comments

@KhoaSydney
Copy link

Hi,

I'm currently facing the problem with bootstrap3-dialog using webpack. At runtime, it said $f.fn is undefined. $ is defined and I have tested with alert($) but not .fn. Please note that jQuery and Bootstrap are loaded so libraries dependency is not the cause of this error. Is there anything else that might causes the problem?

Cheers,

@nakupanda
Copy link
Owner

Hi,

Is there an online example?

@KhoaSydney
Copy link
Author

Hi Nakupanda,

Due to complicated setup with Webpack, I can not post it online. I'm thinking this error cause by jQuery conflict. But beside that I can not think of anything else.

@nakupanda
Copy link
Owner

Ok,

So please paste the error details here, let's see if we can find something inside.

@KhoaSydney
Copy link
Author

I have attached an image which desribes the error. As you can see from the right window panel, $ is defined as a jquery. The left panel show where the error occurred.

error

Sorry this is the only error that I can see. There is no other details.

@nakupanda
Copy link
Owner

What bootstrap version you're using ?

@KhoaSydney
Copy link
Author

Bootstrap v3.3.4

cheers,

@KhoaSydney
Copy link
Author

Should we wrap the factory function in the following format see if it will fix the issue?

function ($) {
  'use strict';
  var version = $.fn.jquery.split(' ')[0].split('.')
  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
    throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
  }
}(jQuery);

@nakupanda
Copy link
Owner

If it doesn't take to too much time I would suggest to do so.

But can you please also provide what jQuery version you're using, and, did you load it prior to bootstrap?

@KhoaSydney
Copy link
Author

Ok by wrapping it with (jQuery) fixed the error but I have a new error now. this in this.defaultOptions is null.

error

@KhoaSydney
Copy link
Author

jQuery JavaScript Library v2.1.3.

@nakupanda
Copy link
Owner

Strange, can't figure it out at this moment

@KhoaSydney
Copy link
Author

The second fix is posted in another issue:
#142

in short change
module.exports = factory(require('jquery')(root)); to module.exports = factory

I hope this will be useful for other people who have the same problems.

cheers

@KhoaSydney
Copy link
Author

Hi Nakupanda,

Would you commit fix for the errors mentioned above so that I don't need to add the fix each time I update the package?

cheers,
Khoa

@nakupanda
Copy link
Owner

Hi,

Changes will be committed today, before that please use your local patch, thank you :)

@KhoaSydney
Copy link
Author

👍

@nakupanda
Copy link
Owner

I'm sorry I was too busy today. Will have it done tomorrow.

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

2 participants