opentip
opentip copied to clipboard
Invalid element message
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:
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
+1
I also tried some thing like this and got the error "Invalid element"
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
Only $("#tags a.tag").each(function() { new Opentip(this, { style: "tag" }); });