jq多行溢出隐藏

  <script type="text/javascript">
   $(function() {
     
     
       $("p").each(function() {
     
     
           var maxwidth = 100;
           if ($(this).text().length > maxwidth) {
               $(this).text($(this).text().substring(0, maxwidth));
               $(this).html($(this).html() + '...');
           }
       });
   })
    </script>

真的很好用~~~

猜你喜欢

转载自blog.csdn.net/lzq_20150715/article/details/78860436