Smith
Smith

Reputation: 3

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

Upvotes: 0

Views: 2585

Answers (2)

fenway
fenway

Reputation: 446

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

Upvotes: 0

Myles
Myles

Reputation: 21520

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.

Upvotes: 1

Related Questions