[css] Detect if an input has text in it using CSS -- on a page I am visiting and do not control?

You can use the :placeholder-shown pseudo class. Technically a placeholder is required, but you can use a space instead.

_x000D_
_x000D_
input:not(:placeholder-shown) {_x000D_
  border-color: green;_x000D_
}_x000D_
_x000D_
input:placeholder-shown {_x000D_
  border-color: red;_x000D_
}
_x000D_
<input placeholder="Text is required" />_x000D_
<input placeholder=" " value="This one is valid" />_x000D_
<input placeholder=" " />
_x000D_
_x000D_
_x000D_

Examples related to css

need to add a class to an element Using Lato fonts in my css (@font-face) Please help me convert this script to a simple image slider Why there is this "clear" class before footer? How to set width of mat-table column in angular? Center content vertically on Vuetify bootstrap 4 file input doesn't show the file name Bootstrap 4: responsive sidebar menu to top navbar Stylesheet not loaded because of MIME-type Force flex item to span full row width

Examples related to input

Angular 4 - get input value React - clearing an input value after form submit Min and max value of input in angular4 application Disable Button in Angular 2 Angular2 - Input Field To Accept Only Numbers How to validate white spaces/empty spaces? [Angular 2] Can't bind to 'ngModel' since it isn't a known property of 'input' Mask for an Input to allow phone numbers? File upload from <input type="file"> Why does the html input with type "number" allow the letter 'e' to be entered in the field?

Examples related to is-empty

ValueError when checking if variable is None or numpy.array Best way to verify string is empty or null Check string for nil & empty What is the best way to test for an empty string in Go? Detect if an input has text in it using CSS -- on a page I am visiting and do not control? Checking if a collection is empty in Java: which is the best method? How to check if a file is empty in Bash? Check if array is empty or null How to convert empty spaces into null values, using SQL Server? VBA Check if variable is empty

Examples related to stylish

Detect if an input has text in it using CSS -- on a page I am visiting and do not control?