rix
rix

Reputation: 10642

Jquery each, how to apply to element and not object?

So i need to use tiptip (a tip plugin) like this:

$('#my-element').tipTip('show');

In my code I have:

var cells = $('.' + all_cells);  //cells refers to all div's with class cells
cells.each(function() {
          $(this)
          .removeClass('my_links') //fine
          .append('<div class="temp"></div>')  //fine
          .tipTip({ edgeOffset: 10, delay: 0, fadeIn: 0 }); //fine
          .tipTip('show') //syntax error

I guess this is because cells isn't an element but an object.

Similarly,

 $('.' + all_cells)
 .attr('title', 'something'))
 .tipTip({ edgeOffset: 10, delay: 0, fadeIn: 100, fadeOut: 100, maxWidth: "300px" });
 .tipTip('show') //syntax error

How can I use tipTip('show'); in these loops please?

Upvotes: 1

Views: 39

Answers (1)

Denys S&#233;guret
Denys S&#233;guret

Reputation: 382274

You have a syntax error :

... ;
.tiptip(...

Remove the ; just before the last line.

Upvotes: 2

Related Questions