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

TypeError: Object [object Object] has no method 'messenger' #65

Closed
dgilfoy opened this issue Feb 12, 2014 · 4 comments
Closed

TypeError: Object [object Object] has no method 'messenger' #65

dgilfoy opened this issue Feb 12, 2014 · 4 comments

Comments

@dgilfoy
Copy link

dgilfoy commented Feb 12, 2014

Trying to have multiple messenger containers on a single page (one standard, attached to body, the other contained in a wrapper div). However, I'm having some issues getting it to work as outlined in the Docs.

When I try to set an instance such as:

$('.messenger-wrapper').messenger(); 

I get the error

TypeError: Object [object Object] has no method 'messenger'

Not quite sure what I'm doing wrong. I'm loading jQuery first, then messenger and then the js file that contains my initialization. There are a few other libraries being called in between those files, but not getting any conflict errors.

I don't see the .messenger method anywhere in the jQuery object either (Chrome Developer tools).

Thanks in advance, it works wonderfully with once instance, but getting that second one is proving to be a bit tougher.

@zackbloom
Copy link
Contributor

The messenger function gets added here: https://github.com/HubSpot/messenger/blob/master/src/coffee/messenger.coffee#L719 on the jQuery object available globally when you bring the file in: https://github.com/HubSpot/messenger/blob/master/src/coffee/messenger.coffee#L1

Is there any chance you're bringing in two copies of jQuery?

@dgilfoy
Copy link
Author

dgilfoy commented Feb 12, 2014

Thanks for the quick response, zackbloom,

Not that I can tell. Unfortunately I'm having to use Drupal (and using the jQuery update module - so 1.8.2), but also using the 'jQuery Once' plugin (some module or another is using it) and the jQuery Foundation tooltips library (Foundation 3...) and also jQuery UI.

I double checked my resources tab, and my network tab in dev tools, and not seeing anything on that end. I'll keep trying stuff and keep you posted if I notice anything though.

@zackbloom
Copy link
Contributor

If you want to log jQuery when it's added, and again when you're trying to use it, maybe that will help elucidate what's going on?

@dgilfoy
Copy link
Author

dgilfoy commented Feb 13, 2014

Thanks zack, that led me to figure out there was some scope issues, seems to be working just fine now, thanks again for such a great library.

@dgilfoy dgilfoy closed this as completed Feb 13, 2014
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