In the below piece of code I am getting the JSLint error (Don't make functions within a loop). can you help me to modify the code to satisfy the JSLint.
setEllipsis : function () {
$('.co_documentReportTable > thead > tr > th').each(function() {
$(this).find('.co_dcrTable_Header').each(function() {
var $el = $(this);
if($el.css("overflow") === "hidden") {
var text = $el.html();
while ($el.height() > 64) {
$el.text(function (index, text) {
return text.replace(/\W*\s(\S)*$/, '...');
});
//
var txt = 'Fair consideration/no fraudulent conveyance';
if(text.indexOf(txt) !== -1 ) {
$el.text(txt + '...');
}
}
}
});
});
}
I tried creating another function and calling it then in that case while loop is getting executed forever.
[javascript] closure loophere on SO.