开发者

Limiting characters inside HTML paragraph

开发者 https://www.devze.com 2022-12-10 16:24 出处:网络
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.

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

精彩评论

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