js如何获取文本行数

高度/行高=文本行数

<script>

    // 高度/行高=文本行数
    var rowNum=Math.round($(".txt").height()/parseFloat($(".txt").css('line-height')));
    alert("当前有"+rowNum+"行");
</script>
posted @ 2020-04-14 12:46  坤嬷嬷  阅读(6159)  评论(0编辑  收藏  举报