开发者

Limiting characters inside HTML paragraph

I want to make it so there's only 350 characters inside the paragraph, regardless of how many characters are put into it, I only want 350 displayed.

How can I do this? The text is just in a div 开发者_高级运维tag in

text.

Cheers


You could put the text into a textbox, style away the fact that it's in a textbox and then limit the length on the textbox using the size attribute.

However, the ideal solution would be to limit it on the server side.


You can also inspect the contents via the DOM in JavaScript if you feel like a client-side solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜