I’m working on a tooltip plugin for jQuery, and I’d like to use the .data method to check if a tooltip has already been opened for the attached object. Right now I’m getting the following error out of the console:
Uncaught TypeError: Object # has no method ‘data’
Here is a paste of my plugin: http://pastebin.com/nsrBCb2Y
If I use the exact example from the jQuery website it works (the $(‘body’).data() one) but it seems like using this.data() causes problems. Does anyone know if you can use the .data method on ‘this’ in a plugin? Or even better if anyone know why this doesn’t work, I’d be happy to know.
All cases of
should be
Inside of the live bound event handler,
thisrefers to the DOM node, not a jquery collection containing the dom node.