0

I have dynamic text which is loaded in table. I want to add popup/tooltip if the text has the css text-overflow:ellipses.

How can I fetch those td only which has the longer text than the width of column.

Ember.$('*').filter(function() {
            return Ember.$(this).css('text-overflow') === 'ellipsis';
        }).each(function(elm){
});

I tried above code to get the td which has text-overflow: ellipsis. But in elm I am getting number. I need complete element of td.

Asmita
  • 1,160
  • 3
  • 10
  • 31

1 Answers1

1

The $('selector').each() passes the Index and the the Element to the callback. This is why you're just seeing a number. See more:

https://api.jquery.com/each/

Try this:

Ember.$('*').filter(function() {
  return Ember.$(this).css('text-overflow') === 'ellipsis';
}).each(function(ind, elm){
  // do things to elm now
});

This may give you more than just <td> elements, so be careful. May add:

return Ember.$(this).find("td").css('text-overflow') === 'ellipsis';

Hope that helps.

Twisty
  • 30,304
  • 2
  • 26
  • 45