Is it possible to know if an input is empty with only CSS?
I had that question when I tried to make an autocomplete component for Learn JavaScript...
For further actions, you may consider blocking this person and/or reporting abuse
Hi Zell, great article!
This regexp should work:
\s?\S+.*
it means: 1 optional space followed by at least one non space followed by whatever.
I tested it and:
Thanks!
Damn this is good CSS stuff. Awesome post Zell.
Thank you!
Try pattern=“\S+“ which means has to contain 1 or more non-white-space characters
Since pattern works like
new RegExp('^'+pattern+'$')
, this won't work if there are white-space characters in the input value.thanks for great investigation! Could you please reveal browser support for this method?)
caniuse.com/#feat=input-pattern
This is pretty cool. Thanks for sharing Zell. :)