0

How can i change background of a input with type of number when it's value is more than 100 or less than 1 . I want to use css.

31st Aug 2020, 5:47 PM
parsa
parsa - avatar
2 Réponses
+ 1
You can't with css as far as I know ,but you can use js to do easily var input=document.querySelectot("input[type=number]"); input.oninput=(e)=>{ If(e.target.value>100){ e.target.backgroundColor="red"; } }
31st Aug 2020, 5:52 PM
Abhay
Abhay - avatar
0
You have to use js as suggested by Abhay Css is use to design elements not to validate . Html 5 have some built-in validation but it not fullfill your condition.
31st Aug 2020, 6:16 PM
Divya Mohan
Divya Mohan - avatar