2

here is the image to explain it

div line

<div id="tshirt">
    <div id="text-wrapper">
        <p id="tshirtover">Nothing is impossible unless we try it</p>
    </div>
</div>

Is there any way to find the length of the first line?

I tried below jQuery function. It's giving the entire length of the string.

$("#tshirtover").text().length;

But i need to find only the first line. Is it possible to get it?

4

1 に答える 1

2

私が考えることができる唯一の方法は、空のdiv(固定幅)を作成し、文字ごとにテキストの入力を開始し、カウンターを使用して配置された文字数を保存し、divの高さを監視することです、高さが変わるとすぐに、新しい行が始まったことを意味します。

于 2012-07-24T07:23:16.370 に答える