Iterate through table data and append ellipsis

Iterate through table data and append ellipsis

Hi folks,

 I'm very new to jQuery and javascript in general. I did some googling and was able to find a jFiddle that did what I wished to accomplish after I modified it a bit to show the original text on mouse over by appending it to the title.

 The problem I now face is that all my content is loaded dynamically. I encapsulated the jQuery function inside a javascript function which allows me to call it at the end of my vbscript function. It fires once, but won't fire again.
I was hoping you could help me out. Here is what i've thrown together for a function.

  1. function initTableDataFormat()
    {

        $( function(){
           
            $.each($('td').not(':empty'), function(i,v){
           
                if ($(this).attr("class") != 'chapter' ){
               
                var count = parseInt($(this).text().length);
                var maxChars = 210;
               
                if(count > maxChars){
                   
                    var str = $(this).text();
                    var trimmed = str.substr(0, maxChars);
           
                    $(v).text(trimmed + '...');         
                    $(v).prop('title', str );         
                }
               
                }
          
            });
           
           
        });
       
    }




























Thanks!