How do I prevent only spaces in the text area? I don't want to allow only white spaces in the text area using HTML pattern or Validator.pattern.
Asked
Active
Viewed 294 times
0
10 Rep
- 2,156
- 7
- 17
- 31
geekyLucifer
- 1
- 2
-
https://stackoverflow.com/questions/12568451/regex-pattern-for-contains-not-only-spaces, the pattern `.*[^ ].*` – Eliseo Oct 13 '20 at 08:06
-
added the $.trim() method – KashyapVadi Oct 13 '20 at 19:50
-
thanks @Eliseo that pattern worked – geekyLucifer Oct 14 '20 at 08:45
1 Answers
0
You can use this regex for no spaces:
<form>
<input type="text" pattern="[^' ']+" />
</form>
MauriceNino
- 5,616
- 1
- 18
- 49
Arkalex
- 103
- 6
-
It blocks all the spaces btween the text. I want to restrict only spaces not spaces between text – geekyLucifer Oct 14 '20 at 08:39