在jquery中隐藏字符

Val*_* Do 6 jquery

我需要在35后隐藏角色,当我悬停文字显示全文帮助我

<a class="dep_buttons" href="#"> something text something text something text something text something text something text </a>

$('.dep_buttons').mouseover(function () { 
    if($(this).text().length > 30) {
       $(this).stop().animate({height:"150px"},150);
}
})
$(".dep_buttons").mouseout(function(){
    $(this).stop().animate({height:"40px"},150);
});
Run Code Online (Sandbox Code Playgroud)

P.S*_*man 4

演示小提琴

jQuery

    $(function () {
    $('.dep_buttons').each(function () {
            var stringText = $(this).text().trim();
            var substringText=stringText.substring(stringText,35);
            var remainingText=stringText.substr(35);
        $(this).html(substringText);
         $('.dep_buttons').mouseover(function () { 
                $(this).find('a').show();
          }).mouseout(function(){
                $(this).find('a').hide();
            });

        $('<a style="display:none;">'+remainingText+'                 </a>').appendTo($(this));
        });
});
Run Code Online (Sandbox Code Playgroud)