enyo / opentip

Opentip is an open source javascript tooltip based on the protoype framework.
http://www.opentip.org
1.25k stars 401 forks source link

Invalid element message #76

Open ghost opened 11 years ago

ghost commented 11 years ago

I am attempting to use opentip but I’m not a javascript programmer. I have a simple test page setup (http://belgians.com/testing.html) that loads the necessary scripts. Where I’m having trouble is loading it programatically. I’m using one of the examples from your documentation but consistently come up with the “if(this.triggerElement.length<1){throw new Error(“Invalid element.”);}” throwing the Invalid element message.

This is how I have it programmed: testing

My goal is to have an Ingredients list on a page and the visitor hovers over each item and sees the corresponding ingredient description similar to this page (http://www.alabu.com/beautiful-feet-foot-scrub/).

Thanks for any help, Kent

hegdeashwin commented 10 years ago

+1

I also tried some thing like this and got the error "Invalid element"

Rdbaker commented 10 years ago

The jquery object's .each() method takes a single function as an argument. If this function takes a parameter, the parameter will be the index of the element in the array which is being iterated, while this will the the current element in the array.

As it stands, you are currently passing 0 as the element parameter to the Opentip constructor.

See here for more on jQuery's .each() function.

@enyo you should close this issue, as it is not a problem with Opentip

argerim commented 10 years ago

Only $("#tags a.tag").each(function() { new Opentip(this, { style: "tag" }); });