Answers for "input html not empty"

CSS
3

check if input is empty css

/* If input is not empty */
input:not(:placeholder-shown) {
  /* You need to add a placeholder to your fields. For example: <input "placeholder=" "/> */
  border-color: green;
}

/* If input is empty */
input:placeholder-shown {
  border-color: red;
}
Posted by: Guest on October-27-2020
0

empty input field on click

<button onclick=
            "document.getElementById(
             'inputField').value = '' ">
      Click To Clear
  </button>
Posted by: Guest on August-10-2021

Browse Popular Code Answers by Language