opentip icon indicating copy to clipboard operation
opentip copied to clipboard

Invalid element message

Open ghost opened this issue 11 years ago • 3 comments

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

ghost avatar Aug 13 '13 22:08 ghost

+1

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

hegdeashwin avatar May 12 '14 06:05 hegdeashwin

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

Rdbaker avatar Aug 12 '14 02:08 Rdbaker

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

argerim avatar Aug 14 '14 01:08 argerim