css3 - Apply style to all input text not empty via CSS -


can done via css3 ?

var inputs = document.getelementsbytagname("input"); (var = 0; < inputs.length; i++) {     if (inputs[i].type == "text")     {         if (inputs[i].value != "")         {             inputs[i].style.borderbottomcolor = '#448aff';         }     } }  var textareas = document.getelementsbytagname("textarea"); (var = 0; < textareas.length; i++) {     if (textareas[i].value != "")     {         textareas[i].style.borderbottomcolor = '#448aff';     } }     

i don't mind not supporting ie10.

textarea:valid, input:valid {     border-bottom-color: #448aff; } 

also need add pattern=".*?\s.*" (only valid @ least 1 non-space character) , required attributes thos pseudo-classes. want customise :invalid state, too.


Comments