This time I will bring you jQuery to automatically add ellipses when the input text exceeds the specified number of lines. jQuery will automatically add ellipsis when the input text exceeds the specified number of lines.What are the precautions?. Here are the actual cases. , let’s take a look.
jQuery自动添加省略号
You probably can't do it (currently?) without a fixed-width font like Courier. With a fixed-width font every letter occupies the same horizontal space, so you could probably count the letters and multiply the result with the current font size in ems or exs. Then you would just have to test how many letters fit on one line, and then break it up.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Use jQuery to preview locally when uploading images
How to convert the html field in the data to HTML tag
The above is the detailed content of jQuery automatically adds ellipses when the input text exceeds the specified number of lines. For more information, please follow other related articles on the PHP Chinese website!