JQ 文本超出

mac2022-06-30  36

原链接:https://blog.csdn.net/sinat_32546159/article/details/56340528

<script type="text/javascript"> $(function () { $("p").each(function () { var maxwidth = 13; if ($(this).text().length > maxwidth) { $(this).text($(this).text().substring(0, maxwidth)); $(this).html($(this).html() + '...[<a href="#">详细</a>]'); } }); }) </script>

 

转载于:https://www.cnblogs.com/SeNaiTes/p/8892969.html

相关资源:js文字超出规定长度隐藏,点击展开和收缩
最新回复(0)