Hi all, how can I make a word length limit. For example you cant post a word with 32+ characters.
If the data is coming from a form you can use max length=“32”
This will make the whole post with 32 characters limit not only the word.
What data are you expecting that has multiple words that cant be over 32 characters in each word?
My forum was bugging when someone entered a word like:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
But anyways i added
word-break: break-all;
to my css file and it’s working fine.
That is not what you asked for. You asked for a limit. That does not limit anything.
Yep i wanted a word length limit so they cant post words like:
ASDSADADASFSAFSAFASFAFAFSAFASFSAFFSFSAFSAFASFSAFASFSAFASF
cause they are too long and have more than 32 characters.
Have a read of this this.
Get the words from the string into an array and check the long(est) words char length.
Hope that helps.
Red
Thanks a lot! I’ll have a look on it.
Can use javascript or PHP’s substr, maxlength on input boxes or jquery $(element).val().length or $(element).length depending on whats being targeted.