Put the string into the specified range, the exceeded part automatically changes "..." perfectly

zhaozj2021-02-17  29

The latest diary and the latest comments in the YLOG.NET homepage, the contents of the diary and the contents of the comments are often overspeed and automatically wrapped. You can only describe the two words, which makes me headache ...

The first thing I thought is to intercept one, so I wrote this function.

This operational JS, performs the server burden on the client, and the JS has speed advantage when the string is operated.