Tengo un problema en donde necesito ejecutar una función al terminar de ejecutarse un bucle while. Tengo esto
Código PHP:
   // Código para adaptar texto al alto de un contenedor ".cortar"  agregando tres puntos suspensivos al final
   var containerHeight = $(".cortar").height();
    var $text = $(".divCortar");    
    
    while ( $text.outerHeight(true) > containerHeight) {
        $text .text(function (index, text) {
            return text.replace(/W*s(S)*$/, '...');
        });
    } //Al terminar de ejecutarse el While necesito agregar una nueva clase al elemento ".div Cortar", pero sólo hasta que termine el while 
    Saludos y gracias
 

